Reboot after successful upgrade
This commit is contained in:
parent
c7093dd177
commit
3795fcbeea
|
@ -19,10 +19,6 @@ export DEBUG
|
||||||
# APT temp file to monitor
|
# APT temp file to monitor
|
||||||
readonly APT_TMP_FILE="/tmp/.apt.upgrade"
|
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
|
## Colors
|
||||||
readonly PURPLE='\033[1;35m'
|
readonly PURPLE='\033[1;35m'
|
||||||
readonly RED='\033[0;31m'
|
readonly RED='\033[0;31m'
|
||||||
|
@ -104,54 +100,6 @@ NO APT upgrade available for this system."
|
||||||
|
|
||||||
return "${return_apt_upgrade_present}"
|
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() { # {{{
|
is_queue_enable() { # {{{
|
||||||
|
@ -331,19 +279,13 @@ main() { # {{{
|
||||||
|
|
||||||
## Try to upgrade the system
|
## Try to upgrade the system
|
||||||
### If error: Exit 50
|
### If error: Exit 50
|
||||||
### If success: Clean host (temp files, download,…)
|
|
||||||
upgrade_system \
|
upgrade_system \
|
||||||
|| exit 50 \
|
|| 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
|
## Finish by cleaning temp files
|
||||||
### Reboot the system
|
### and reboot the system
|
||||||
is_maco_upgrade_absent \
|
clean_host \
|
||||||
&& systemctl reboot
|
&& systemctl reboot
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue