bundles/apt: add flag to disable automatic rebooting
Some checks failed
kunsi/bundlewrap/pipeline/head There was a failure building this commit
Some checks failed
kunsi/bundlewrap/pipeline/head There was a failure building this commit
This commit is contained in:
parent
4c59479d5c
commit
fb931df4f0
3 changed files with 15 additions and 5 deletions
|
@ -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
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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)}"
|
||||||
|
|
Loading…
Reference in a new issue