From 8daa80803d336711ed34a43c6c219000cbcf6147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Thu, 18 Jun 2020 17:02:39 +0200 Subject: [PATCH] Check if any Maco upgrade is present MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To allow the upgrade before applying any required reboot,… --- cluster/apt.apply.update.sh | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/cluster/apt.apply.update.sh b/cluster/apt.apply.update.sh index 2baf78d..9432d1e 100755 --- a/cluster/apt.apply.update.sh +++ b/cluster/apt.apply.update.sh @@ -16,9 +16,13 @@ readonly NBARGS="${#}" ## Export DEBUG for sub-script export DEBUG -# Temp file to monitor +# APT temp file to monitor readonly APT_TMP_FILE="/tmp/.apt.upgrade" +# Maco temp file +readonly MACO_TMP_FILE="/tmp/.maco.upgrade" +readonly MACO_TMP_URGENT_FILE="/tmp/.maco.urgent.upgrade" + ## Colors readonly PURPLE='\033[1;35m' readonly RED='\033[0;31m' @@ -98,6 +102,30 @@ NO APT upgrade available for this system." return "${return_apt_upgrade_present}" +} +# }}} +is_maco_upgrade_present() { # {{{ + + return_maco_upgrade_present="1" + + ## 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 − \ +Maco urgent upgrade seems available." + else + debug_message "is_maco_upgrade_present − \ +No Maco upgrade require." + fi + + return "${return_maco_upgrade_present}" + } # }}} is_queue_enable() { # {{{ @@ -230,6 +258,11 @@ main() { # {{{ ## Try to upgrade the system upgrade_system + ## If Maco upgrade is present + ### Exit (and leave Maco manage required reboot if present) + is_maco_upgrade_present \ + && exit 0 + } # }}}