Check if any Maco upgrade is present

To allow the upgrade before applying any required reboot,…
This commit is contained in:
Jeremy Gardais 2020-06-18 17:02:39 +02:00
parent c3cd76960c
commit 8daa80803d
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 34 additions and 1 deletions

View File

@ -16,9 +16,13 @@ readonly NBARGS="${#}"
## Export DEBUG for sub-script ## Export DEBUG for sub-script
export DEBUG export DEBUG
# 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'
@ -98,6 +102,30 @@ 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_queue_enable() { # {{{ is_queue_enable() { # {{{
@ -230,6 +258,11 @@ main() { # {{{
## Try to upgrade the system ## Try to upgrade the system
upgrade_system upgrade_system
## If Maco upgrade is present
### Exit (and leave Maco manage required reboot if present)
is_maco_upgrade_present \
&& exit 0
} }
# }}} # }}}