Add possibility to check for urgent upgrade only
This commit is contained in:
parent
2036f081fe
commit
ab742e8295
|
@ -26,6 +26,9 @@ export OUTPUT_MESSAGE
|
|||
# If modifications should be applied
|
||||
[ -z "${SIMULATE_MODE}" ] && SIMULATE_MODE=1
|
||||
|
||||
# If only urgent upgrade should be checked
|
||||
[ -z "${URGENT_ONLY_MODE}" ] && URGENT_ONLY_MODE=1
|
||||
|
||||
## Colors
|
||||
readonly PURPLE='\033[1;35m'
|
||||
readonly RED='\033[0;31m'
|
||||
|
@ -42,7 +45,7 @@ readonly MACO_TMP_URGENT_FILE="/tmp/.maco.urgent.upgrade"
|
|||
usage() { # {{{
|
||||
|
||||
cat <<- EOF
|
||||
usage: $PROGNAME [-d|-h|-s|-q]
|
||||
usage: $PROGNAME [-d|-h|-q|-s|-u]
|
||||
|
||||
Compare current version of Maco script with the latest and
|
||||
the urgent versions then try to prepare the host by:
|
||||
|
@ -52,6 +55,9 @@ EXAMPLES:
|
|||
- Verify Maco's upgrade and prepare the current host
|
||||
${PROGNAME}
|
||||
|
||||
- Verify only urgent upgrade for Maco and prepare the current host
|
||||
${PROGNAME} --urgent
|
||||
|
||||
OPTIONS :
|
||||
-d,--debug
|
||||
Enable debug messages.
|
||||
|
@ -59,11 +65,14 @@ OPTIONS :
|
|||
-h,--help
|
||||
Print this help message.
|
||||
|
||||
-q,--quiet
|
||||
Disable messages on standard output (except for error).
|
||||
|
||||
-s,--simulate
|
||||
Only display messages and don't manage temp files.
|
||||
|
||||
-q,--quiet
|
||||
Disable messages on standard output (except for error).
|
||||
-u,--urgent
|
||||
Check only for urgent upgrade.
|
||||
EOF
|
||||
|
||||
|
||||
|
@ -242,13 +251,28 @@ main() { # {{{
|
|||
is_maco_uptodate \
|
||||
&& exit 0
|
||||
|
||||
is_maco_upgrade_require \
|
||||
&& prepare_host_for_upgrade \
|
||||
&& exit 0
|
||||
## If URGENT_ONLY_MODE is set
|
||||
if [ "${URGENT_ONLY_MODE}" -eq "0" ]; then
|
||||
### Check only for urgent upgrade {{{
|
||||
is_maco_urgent_upgrade_require \
|
||||
&& prepare_host_for_upgrade \
|
||||
&& exit 0
|
||||
### }}}
|
||||
|
||||
is_maco_urgent_upgrade_require \
|
||||
&& prepare_host_for_upgrade \
|
||||
&& exit 0
|
||||
else
|
||||
### Check for latest upgrade {{{
|
||||
is_maco_upgrade_require \
|
||||
&& prepare_host_for_upgrade \
|
||||
&& exit 0
|
||||
### }}}
|
||||
|
||||
### Check for urgent upgrade {{{
|
||||
is_maco_urgent_upgrade_require \
|
||||
&& prepare_host_for_upgrade \
|
||||
&& exit 0
|
||||
### }}}
|
||||
|
||||
fi
|
||||
|
||||
}
|
||||
# }}}
|
||||
|
@ -263,17 +287,17 @@ if [ ! "${NBARGS}" -eq "0" ]; then
|
|||
while printf -- '%s' "${1}" | grep -q -E -- "^-+"; do
|
||||
|
||||
case "${1}" in
|
||||
-h|--help ) ## help
|
||||
-h|--help ) ## help
|
||||
usage
|
||||
## Exit after help informations
|
||||
exit 0
|
||||
;;
|
||||
-d|--debug ) ## debug
|
||||
-d|--debug ) ## debug
|
||||
DEBUG=0
|
||||
## Re-export new DEBUG value
|
||||
export DEBUG
|
||||
;;
|
||||
-q|--quiet ) ## Silent mode
|
||||
-q|--quiet ) ## Silent mode
|
||||
## Avoid to display any message on standard output
|
||||
OUTPUT_MESSAGE=1
|
||||
;;
|
||||
|
@ -281,7 +305,11 @@ if [ ! "${NBARGS}" -eq "0" ]; then
|
|||
## Only display messages
|
||||
SIMULATE_MODE=0
|
||||
;;
|
||||
-- ) ## End of options list
|
||||
-u|--urgent ) ## Urgent upgrade only
|
||||
## Check only for urgent upgrade
|
||||
URGENT_ONLY_MODE=0
|
||||
;;
|
||||
-- ) ## End of options list
|
||||
## End the while loop
|
||||
break
|
||||
;;
|
||||
|
|
Loading…
Reference in New Issue