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
17 "$@" |
& systemd-cat
-t myupgrade
19 l
/a
/bin
/buildscripts
/tor-browser
20 l
/a
/bin
/buildscripts
/go
21 l
/a
/bin
/buildscripts
/rust
22 l
/a
/bin
/buildscripts
/misc
23 l go get
-u mvdan.cc
/fdroidcl
25 cmd
="$s /usr/sbin/checkrestart -p"
26 if [[ $
($cmd |
sed '/^Found 0 processes using old versions of upgraded files$/d' |
wc -l) != 0 ]]; then
27 $cmd -v | pee
cat "wall -n"
30 if [[ -s /var
/log
/checkrestart.log
]]; then
32 echo "pid $PID. unattended upgrade, rebooting in $((x*10)) seconds" | wall
-n
36 if ! fuser
/var
/lib
/dpkg
/lock
&> /dev
/null
; then
37 echo "pid $PID. unattended upgrade, rebooting now" | pee
cat "wall -n"
41 echo "pid $PID. unattended upgrade reboot waiting 10 seconds for dpkg lock" | wall
-n
44 echo "pid $PID. dpkg locked for 5 minutes, automatic reboot failed" | pee
cat "wall -n"