Refactor CHECK_UPGRADE
This commit is contained in:
parent
de494b76c1
commit
ce8cf73b0e
|
@ -145,18 +145,15 @@ 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"
|
||||
debug_message "is_apt_upgrade_absent − \
|
||||
### Check if temp APT upgrade file exists
|
||||
if [ -f "${APT_TMP_FILE}" ]; then
|
||||
return_apt_upgrade_present="0"
|
||||
debug_message "is_apt_upgrade_absent − \
|
||||
APT upgrade seems available for this system."
|
||||
else
|
||||
return_apt_upgrade_present="1"
|
||||
debug_message "is_apt_upgrade_absent − \
|
||||
else
|
||||
return_apt_upgrade_present="1"
|
||||
debug_message "is_apt_upgrade_absent − \
|
||||
NO APT upgrade available for this system."
|
||||
fi
|
||||
fi
|
||||
|
||||
return "${return_apt_upgrade_present}"
|
||||
|
@ -168,23 +165,20 @@ 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"
|
||||
debug_message "is_maco_upgrade_present − \
|
||||
## 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 − \
|
||||
## 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 − \
|
||||
else
|
||||
debug_message "is_maco_upgrade_present − \
|
||||
No Maco upgrade require."
|
||||
fi
|
||||
fi
|
||||
|
||||
return "${return_maco_upgrade_present}"
|
||||
|
@ -310,16 +304,18 @@ main() { # {{{
|
|||
## Define all vars according the selected options
|
||||
define_vars
|
||||
|
||||
## If APT package upgrade is available
|
||||
### Exit (wait for APT upgrade to be applied)
|
||||
is_apt_upgrade_present \
|
||||
&& exit 0
|
||||
|
||||
## If Maco upgrade is present
|
||||
### Exit (wait for Maco upgrade to be applied)
|
||||
is_maco_upgrade_present \
|
||||
&& exit 0
|
||||
## 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 \
|
||||
&& exit 0
|
||||
|
||||
## If Maco upgrade is present
|
||||
### 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 \
|
||||
|
|
Loading…
Reference in New Issue