bundles/apt: add flag to disable automatic rebooting
Some checks failed
kunsi/bundlewrap/pipeline/head There was a failure building this commit

This commit is contained in:
Franzi 2022-01-04 15:14:39 +01:00
parent 4c59479d5c
commit fb931df4f0
Signed by: kunsi
GPG key ID: 12E3D2136B818350
3 changed files with 15 additions and 5 deletions

View file

@ -21,6 +21,10 @@ case "$exitcode" in
echo "Upgrades skipped due to active SSH login" echo "Upgrades skipped due to active SSH login"
exit 1 exit 1
;; ;;
reboot)
echo "Upgrades require a reboot, but automatic rebooting is disabled"
exit 1
;;
0) 0)
echo "OK" echo "OK"
exit 0 exit 0

View file

@ -46,11 +46,16 @@ fi
if [[ -f /var/run/reboot-required ]] if [[ -f /var/run/reboot-required ]]
then then
if [[ "$auto_reboot_enabled" == "False" ]]
then
echo "reboot" > "$statusfile"
else
if [[ -n "$reboot_mail_to" ]] if [[ -n "$reboot_mail_to" ]]
then then
date | mail -s "SYSREBOOTNOW $nodename" "$reboot_mail_to" date | mail -s "SYSREBOOTNOW $nodename" "$reboot_mail_to"
fi fi
systemctl reboot systemctl reboot
else
echo "upgrade-and-reboot for node $nodename is DONE"
fi fi
fi
echo "upgrade-and-reboot for node $nodename is DONE"

View file

@ -1,2 +1,3 @@
nodename="${node.name}" nodename="${node.name}"
reboot_mail_to="${node.metadata.get('apt/unattended-upgrades/reboot_mail_to', '')}" reboot_mail_to="${node.metadata.get('apt/unattended-upgrades/reboot_mail_to', '')}"
auto_reboot_enabled="${node.metadata.get('apt/unattended-upgrades/reboot-enabled', True)}"