blob: 6ea5627a3be3633e95bdcb41e8d15c0e07bd6fdd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#!/bin/bash -xe
set -o pipefail
cat > "${root:?}"/usr/sbin/halo-upgrade << EOF
#!/bin/bash -e
set -o pipefail
remote="${remote:?}"
branch="${branch:?}"
remote_ref=\$(ostree remote refs -r "\$remote" | egrep ^"\$remote":"\$branch"'\\s' | awk '{print \$2}')
local_ref=\$(ostree refs -r | egrep ^"\$remote":"\$branch"'\\s' | awk '{print \$2}')
if [ "\$local_ref" != "\$remote_ref" -a -n "\$remote_ref" ]; then
echo "OS Update available. Installing..."
set -x
ostree admin upgrade
grub-mkconfig -o /boot/grub/grub.cfg
set +x
echo "OS Update Installed. Press Enter to Reboot..."
read
reboot
else
echo "No OS Update found."
fi
EOF
chmod 755 "${root:?}"/usr/sbin/halo-upgrade
|