Reboot after successful upgrade

This commit is contained in:
Jeremy Gardais 2021-01-06 11:46:19 +01:00
parent c7093dd177
commit 3795fcbeea
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 3 additions and 61 deletions

View File

@ -19,10 +19,6 @@ export DEBUG
# APT temp file to monitor
readonly APT_TMP_FILE="/tmp/.apt.upgrade"
# Maco temp file
readonly MACO_TMP_FILE="/tmp/.maco.upgrade"
readonly MACO_TMP_URGENT_FILE="/tmp/.maco.urgent.upgrade"
## Colors
readonly PURPLE='\033[1;35m'
readonly RED='\033[0;31m'
@ -104,54 +100,6 @@ NO APT upgrade available for this system."
return "${return_apt_upgrade_present}"
}
# }}}
is_maco_upgrade_present() { # {{{
return_maco_upgrade_present="1"
## Check if temp Maco upgrade file is present
if [ -f "${MACO_TMP_FILE}" ]; then
return_maco_upgrade_present="0"
debug_message "is_maco_upgrade_present \
Maco upgrade seems available."
## Check if temp Maco urgent upgrade file is present
elif [ -f "${MACO_TMP_URGENT_FILE}" ]; then
return_maco_upgrade_present="0"
debug_message "is_maco_upgrade_present \
Maco urgent upgrade seems available."
else
debug_message "is_maco_upgrade_present \
No Maco upgrade require."
fi
return "${return_maco_upgrade_present}"
}
# }}}
is_maco_upgrade_absent() { # {{{
return_maco_upgrade_absent="0"
## Check if temp Maco upgrade file is present
if [ -f "${MACO_TMP_FILE}" ]; then
return_maco_upgrade_absent="1"
debug_message "is_maco_upgrade_absent \
Maco upgrade seems available."
## Check if temp Maco urgent upgrade file is present
elif [ -f "${MACO_TMP_URGENT_FILE}" ]; then
return_maco_upgrade_absent="1"
debug_message "is_maco_upgrade_absent \
Maco urgent upgrade seems available."
else
debug_message "is_maco_upgrade_absent \
No Maco upgrade require."
fi
return "${return_maco_upgrade_absent}"
}
# }}}
is_queue_enable() { # {{{
@ -331,19 +279,13 @@ main() { # {{{
## Try to upgrade the system
### If error: Exit 50
### If success: Clean host (temp files, download,…)
upgrade_system \
|| exit 50 \
&& clean_host
## If Maco upgrade is present
### Exit (and leave Maco manage required reboot if present)
is_maco_upgrade_present \
&& exit 0
## If Maco upgrade is absent
### Reboot the system
is_maco_upgrade_absent \
## Finish by cleaning temp files
### and reboot the system
clean_host \
&& systemctl reboot
}