summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflorian <florian@openbsd.org>2019-04-24 18:11:00 +0000
committerflorian <florian@openbsd.org>2019-04-24 18:11:00 +0000
commit1f99a756d2276903d954f6878b5cf7c62158a603 (patch)
treea2f6b475bda9b8aaaa8128c2b3da9813c4ef9303
parentPerform unattended upgrade if /bsd.upgrade is present. (diff)
downloadwireguard-openbsd-1f99a756d2276903d954f6878b5cf7c62158a603.tar.xz
wireguard-openbsd-1f99a756d2276903d954f6878b5cf7c62158a603.zip
In unattended mode do a reboot even if things go wrong and
additionally install a watchdog to do a reboot after 30 minutes if the script gets completely stuck. A half upgraded system that reboots at least gives us a chance that it will come back and we can fix it. Just having it sit there isn't helping anyone. It would be nicer if the watchdog were kernel based... OK deraadt
-rw-r--r--distrib/miniroot/install.sub9
1 files changed, 7 insertions, 2 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub
index ce3f6616ba8..65df649ff78 100644
--- a/distrib/miniroot/install.sub
+++ b/distrib/miniroot/install.sub
@@ -1,5 +1,5 @@
#!/bin/ksh
-# $OpenBSD: install.sub,v 1.1115 2019/04/24 15:59:22 florian Exp $
+# $OpenBSD: install.sub,v 1.1116 2019/04/24 18:11:00 florian Exp $
#
# Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback
# Copyright (c) 2015, Robert Peichaer <rpe@openbsd.org>
@@ -2871,7 +2871,8 @@ do_autoinstall() {
/$AI_MODE -af /tmp/ai/ai.$AI_MODE.conf 2>&1 </dev/null |
sed "s/^.*$(echo '\r')//;w/tmp/ai/ai.log"
- [[ -f /tmp/ai/ai.done ]] || err_exit "failed; check /tmp/ai/ai.log"
+ $UU || [[ -f /tmp/ai/ai.done ]] ||
+ err_exit "failed; check /tmp/ai/ai.log"
# Email autoinstall protocol to root on next boot.
prep_root_mail /tmp/ai/ai.log "$(hostname) $AI_MODE log"
@@ -3381,6 +3382,10 @@ __EOT
elif $UU; then
MODE=upgrade
check_unattendedupgrade || exit 1
+
+ # trigger watchdog
+ (sleep 1800 && reboot) &
+
cat <<__EOT > /auto_upgrade.conf
Location of sets = disk
Pathname to the sets = /home/upgrade/