Remove temp file only if no upgrade detected

This commit is contained in:
Jeremy Gardais 2020-03-09 11:47:36 +01:00
parent 451cd0b01a
commit b5678dffe2
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 5 additions and 5 deletions

View File

@ -86,9 +86,6 @@ while IFS= read -r nc_new_version; do
touch -- "${nc_new_version_file}"
printf '\e[1;35m%-6s\e[m\n' "An upgrade is available for Nextcloud (current: ${nc_current_version}): ${nc_new_version}." >> "${nc_new_version_file}"
printf '\e[1;35m%-6s\e[m\n' "Please also take a look to the CHANGELOG: https://nextcloud.com/changelog/#latest${nc_new_major}" >> "${nc_new_version_file}"
### Exit to ensure to keep the file in place
exit 0
## }}}
## It's an upgrade for a previous major release {{{
else
@ -99,8 +96,11 @@ while IFS= read -r nc_new_version; do
# }}}
# Same version {{{
else
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG: Test version — The current version is up-to-date."
rm -f -- "${nc_new_version_file}"
## If no previous upgrade was already detected
if [ ! -s "${nc_app_new_version_file}" ]; then
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG: Test version — The current version is up-to-date."
rm -f -- "${nc_new_version_file}"
fi
fi
# }}}