Exit earlier if APT temp file exists

This commit is contained in:
Jeremy Gardais 2021-04-12 09:13:00 +02:00
parent 7bef77a04e
commit ecea1311cc
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 29 additions and 0 deletions

View File

@ -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