From ecea1311cc72ce08f99f211253e2f48e8df7c70f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Mon, 12 Apr 2021 09:13:00 +0200 Subject: [PATCH] Exit earlier if APT temp file exists --- cluster/apt.check.update.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/cluster/apt.check.update.sh b/cluster/apt.check.update.sh index 1ee76a5..3fa5b75 100755 --- a/cluster/apt.check.update.sh +++ b/cluster/apt.check.update.sh @@ -180,6 +180,29 @@ APT upgrade available for this system: ${RED}${local_apt_upgrade_number:=/dev/nu return "${return_apt_upgrade_present}" +} +# }}} +is_file_present() { # {{{ + + local_file_present="${1}" + + ## File doesn't exist by default + return_is_file_present="1" + + ### Check if the file exists + # shellcheck disable=SC2086 + if find ${local_file_present} > /dev/null 2>&1; then + return_is_file_present="0" + debug_message "is_file_present − \ +The file ${RED}${local_file_present}${COLOR_DEBUG} exists." + else + return_is_file_present="1" + debug_message "is_file_present − \ +The file ${RED}${local_file_present}${COLOR_DEBUG} doesn't exist." + fi + + return "${return_is_file_present}" + } # }}} is_sge_slots_empty() { # {{{ @@ -224,6 +247,12 @@ main() { # {{{ && exit 0 ## }}} + ## If APT temp file already exists {{{ + ### Exit + is_file_present "${APT_TMP_FILE}" \ + && exit 0 + ## }}} + ## If EMPTY_ONLY_MODE is set {{{ ### Verify empty slots ### OR Exit