Prepare host if an upgrade is required

This commit is contained in:
Jeremy Gardais 2020-06-12 17:24:34 +02:00
parent 85ded81370
commit 9adce8cb1e
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 20 additions and 6 deletions

View File

@ -57,18 +57,18 @@ debug_message() { # {{{
}
# }}}
message() { # {{{
message() { # {{{
local_message="${1}"
## Print message if OUTPUT_MESSAGE is enable (=0)
[ "${OUTPUT_MESSAGE}" -eq "0" ] && printf '%b' "${local_message}"
[ "${OUTPUT_MESSAGE}" -eq "0" ] && printf '%b\n' "${local_message}"
return 0
}
# }}}
is_maco_urgent_upgrade_require() { # {{{
is_maco_urgent_upgrade_require() { # {{{
return_urgent_upgrade=""
@ -87,7 +87,7 @@ Local Maco (${CURRENT_MACO_VERSION}) is newer than urgent upgrade (${URGENT_MACO
}
# }}}
is_maco_upgrade_require() { # {{{
is_maco_upgrade_require() { # {{{
return_upgrade=""
@ -106,7 +106,7 @@ Local Maco (${CURRENT_MACO_VERSION}) seems up to date (latest: ${LATEST_MACO_
}
# }}}
is_maco_uptodate() { # {{{
is_maco_uptodate() { # {{{
return_uptodate=""
@ -123,6 +123,18 @@ Local Maco version (${CURRENT_MACO_VERSION}) is different from latest version ($
return "${return_uptodate}"
}
# }}}
prepare_host_for_upgrade() { # {{{
disable_host_queue_script="${PROGDIR}/disable.host.queue.sh"
debug_message "prepare_host_for_upgrade \
Disable SGE queue."
sh "${disable_host_queue_script}"
return "${?}"
}
# }}}
main() { # {{{
@ -143,15 +155,17 @@ main() { # {{{
&& exit 0
is_maco_upgrade_require \
&& prepare_host_for_upgrade \
&& exit 0
is_maco_urgent_upgrade_require \
&& prepare_host_for_upgrade \
&& exit 0
}
# }}}
# Manage arguments {{{
# Manage arguments # {{{
# This code can't be in a function due to arguments
if [ ! "${NBARGS}" -eq "0" ]; then