#!/bin/bash
+# Copyright (C) 2019 Ian Kelling
+# SPDX-License-Identifier: AGPL-3.0-or-later
+
+if [ -z "$BASH_VERSION" ]; then echo "error: shell is not bash" >&2; exit 1; fi
+
+set -eE -o pipefail
+trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
+
+hn=$(hostname -f)
+source /a/bin/bash_unpublished/source-state
+if [[ $HOSTNAME == "$MAIL_HOST" || $hn == li.b8.nz ]]; then
+ exit 0
+fi
+
if [[ $(/usr/sbin/checkrestart | wc -l) != 1 ]]; then
for x in {30..1}; do
echo "pid $PID. unattended upgrade, rebooting in $((x*10)) seconds" | wall -n