2 # Copyright (C) 2019 Ian Kelling
3 # SPDX-License-Identifier: AGPL-3.0-or-later
5 if [ -z "$BASH_VERSION" ]; then echo "error: shell is not bash" >&2; exit 1; fi
8 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
11 source /a
/bin
/bash_unpublished
/source-state
12 if [[ $HOSTNAME == "$MAIL_HOST" ||
$hn == li.b8.nz
]]; then
16 if [[ $
(/usr
/sbin
/checkrestart |
wc -l) != 1 ]]; then
18 echo "pid $PID. unattended upgrade, rebooting in $((x*10)) seconds" | wall
-n
22 if ! fuser
/var
/lib
/dpkg
/lock
&> /dev
/null
; then
26 echo "pid $PID. unattended upgrade reboot waiting 10 seconds for dpkg lock" | wall
-n
29 echo "pid $PID. dpkg locked for 5 minutes, automatic reboot failed" | pee
cat "wall -n"