Add EMPTY_ONLY_MODE (exit if slots not empty)
This commit is contained in:
parent
06f7dadcd8
commit
4e87760e43
|
@ -29,7 +29,7 @@ readonly COLOR_DEBUG="${PURPLE}"
|
||||||
usage() { # {{{
|
usage() { # {{{
|
||||||
|
|
||||||
cat <<- EOF
|
cat <<- EOF
|
||||||
usage: $PROGNAME [-d|-h|-t]
|
usage: $PROGNAME [-d|-e|-h|-t]
|
||||||
|
|
||||||
Verify if any APT package upgrade is available and
|
Verify if any APT package upgrade is available and
|
||||||
try to prepare the host by :
|
try to prepare the host by :
|
||||||
|
@ -43,6 +43,9 @@ OPTIONS :
|
||||||
-d,--debug
|
-d,--debug
|
||||||
Enable debug messages.
|
Enable debug messages.
|
||||||
|
|
||||||
|
-e,--empty
|
||||||
|
Check APT upgrades only if SGE slots are empty
|
||||||
|
|
||||||
-h,--help
|
-h,--help
|
||||||
Print this help message.
|
Print this help message.
|
||||||
EOF
|
EOF
|
||||||
|
@ -149,33 +152,31 @@ main() { # {{{
|
||||||
|
|
||||||
## If NO APT package upgrade is available {{{
|
## If NO APT package upgrade is available {{{
|
||||||
### Ensure to remove any temp file related to APT upgrades
|
### Ensure to remove any temp file related to APT upgrades
|
||||||
### Exit
|
### AND Exit
|
||||||
is_apt_upgrade_absent \
|
is_apt_upgrade_absent \
|
||||||
&& rm -f -- "${APT_TMP_FILE}" \
|
&& rm -f -- "${APT_TMP_FILE}" \
|
||||||
&& exit 0
|
&& exit 0
|
||||||
## }}}
|
## }}}
|
||||||
|
|
||||||
## If APT package upgrade(s) is available AND
|
## If EMPTY_ONLY_MODE is set {{{
|
||||||
is_apt_upgrade_present \
|
### Verify empty slots
|
||||||
&& {
|
### OR Exit
|
||||||
## If SGE used slots is NULL {{{
|
if [ "${EMPTY_ONLY_MODE}" -eq "0" ]; then
|
||||||
## APT package upgrade is available
|
### If SGE slots are not empty
|
||||||
### Create a temp file
|
### Exit
|
||||||
### Disable SGE queue
|
|
||||||
is_sge_slots_empty \
|
is_sge_slots_empty \
|
||||||
&& touch "${APT_TMP_FILE}" && echo "APT upgrade is available." >> "${APT_TMP_FILE}" \
|
|| exit 0
|
||||||
|
fi
|
||||||
|
## }}}
|
||||||
|
|
||||||
|
## If APT package upgrade is available {{{
|
||||||
|
### Disable SGE queue
|
||||||
|
### AND Exit
|
||||||
|
is_apt_upgrade_present \
|
||||||
&& sh "${sge_disable_host_queue_script}" \
|
&& sh "${sge_disable_host_queue_script}" \
|
||||||
&& exit 0
|
&& exit 0
|
||||||
## }}}
|
## }}}
|
||||||
|
|
||||||
## After all just add content to a temp file (+1 attempt) {{{
|
|
||||||
touch "${APT_TMP_FILE}" && echo "APT upgrade is available." >> "${APT_TMP_FILE}" \
|
|
||||||
&& debug_message "main − Add content to temp file for pending upgrade(s)." \
|
|
||||||
&& exit 0
|
|
||||||
## }}}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
@ -204,6 +205,9 @@ if [ ! "${NBARGS}" -eq "0" ]; then
|
||||||
-d|--debug ) ## debug
|
-d|--debug ) ## debug
|
||||||
DEBUG=0
|
DEBUG=0
|
||||||
;;
|
;;
|
||||||
|
-e|--empty ) ## Empty only mode
|
||||||
|
EMPTY_ONLY_MODE=0
|
||||||
|
;;
|
||||||
-h|--help ) ## help
|
-h|--help ) ## help
|
||||||
usage
|
usage
|
||||||
## Exit after help informations
|
## Exit after help informations
|
||||||
|
|
Loading…
Reference in New Issue