Refactor CHECK_UPGRADE

This commit is contained in:
Jeremy Gardais 2020-06-22 20:46:37 +02:00
parent de494b76c1
commit ce8cf73b0e
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 28 additions and 32 deletions

View File

@ -145,8 +145,6 @@ is_apt_upgrade_present() { # {{{
## No pending upgrade by default
return_apt_upgrade_present="1"
## If we need to watch for upgrades
if [ "${CHECK_UPGRADE}" -eq "0" ]; then
### Check if temp APT upgrade file exists
if [ -f "${APT_TMP_FILE}" ]; then
return_apt_upgrade_present="0"
@ -157,7 +155,6 @@ APT upgrade seems available for this system."
debug_message "is_apt_upgrade_absent \
NO APT upgrade available for this system."
fi
fi
return "${return_apt_upgrade_present}"
@ -168,8 +165,6 @@ is_maco_upgrade_present() { # {{{
## No pending upgrades by default
return_maco_upgrade_present="1"
## If we need to watch for upgrades
if [ "${CHECK_UPGRADE}" -eq "0" ]; then
## Check if temp Maco upgrade file is present
if [ -f "${MACO_TMP_FILE}" ]; then
return_maco_upgrade_present="0"
@ -185,7 +180,6 @@ Maco urgent upgrade seems available."
debug_message "is_maco_upgrade_present \
No Maco upgrade require."
fi
fi
return "${return_maco_upgrade_present}"
@ -310,6 +304,8 @@ main() { # {{{
## Define all vars according the selected options
define_vars
## If we need to watch for upgrades
if [ "${CHECK_UPGRADE}" -eq "0" ]; then
## If APT package upgrade is available
### Exit (wait for APT upgrade to be applied)
is_apt_upgrade_present \
@ -319,7 +315,7 @@ main() { # {{{
### Exit (wait for Maco upgrade to be applied)
is_maco_upgrade_present \
&& exit 0
fi
## Simple debug message with color to valid current variables
debug_message "main Try to manage \