summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkn <kn@cvs.openbsd.org>2019-08-13 07:47:41 +0000
committerkn <kn@cvs.openbsd.org>2019-08-13 07:47:41 +0000
commit1f6e4db9b29291bf280d406c810b4dca4bef3c90 (patch)
tree418e190766156ffc0ae1024e40943d4f9c775106
parentb7ebe12cf05f367b97905d635d207436edb3c4fb (diff)
Reset sysupgrade watchdog upon every set installation
Instead of having a single timeout for the entire upgrade, start anew right before extracting each set's tarball. Do so by replacing the background job with a proper co-process that gets killed and restarted (reset), analogue to the dmesg listener in interactive mode. Prompted by and OK sthen OK deraadt
-rw-r--r--distrib/miniroot/install.sub27
1 files changed, 24 insertions, 3 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub
index 2e1d361e81f..a2add06a7ee 100644
--- a/distrib/miniroot/install.sub
+++ b/distrib/miniroot/install.sub
@@ -1,5 +1,5 @@
#!/bin/ksh
-# $OpenBSD: install.sub,v 1.1137 2019/08/11 13:32:41 kn Exp $
+# $OpenBSD: install.sub,v 1.1138 2019/08/13 07:47:40 kn Exp $
#
# Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback
# Copyright (c) 2015, Robert Peichaer <rpe@openbsd.org>
@@ -1604,6 +1604,8 @@ install_files() {
# Fetch and verify the set files.
for _f in $_get_sets; do
+ $UU && reset_watchdog
+
rm -f /tmp/h /tmp/fail
# Fetch set file and create a checksum by piping through
@@ -3238,6 +3240,26 @@ check_unattendedupgrade() {
) > /dev/null 2>&1
}
+WATCHDOG_PERIOD_SEC=$((45 * 60))
+
+# Restart the background timer.
+reset_watchdog() {
+ kill -KILL $WDPID 2>/dev/null
+ start_watchdog
+}
+
+# Start a co-process to reboot a stalled sysupgrade.
+# This mechanism is only used during non-interactive sysupgrade.
+start_watchdog() {
+ (
+ sleep $WATCHDOG_PERIOD_SEC && reboot
+ ) |&
+ WDPID=$!
+
+ # Close standard input of the co-process.
+ exec 3>&p; exec 3>&-
+}
+
# ------------------------------------------------------------------------------
# Initial actions common to both installs and upgrades.
#
@@ -3386,8 +3408,7 @@ elif $UU; then
MODE=upgrade
check_unattendedupgrade || exit 1
- # trigger watchdog
- (sleep 2700 && reboot) &
+ start_watchdog
cat <<__EOT > /auto_upgrade.conf
Location of sets = disk