NC: Update test if an app's upgrade is available

occ app:update change the message if no upgrade…
This commit is contained in:
gardouille 2024-06-01 08:58:51 +02:00
parent 7d2e20ed02
commit 5437d6fd18
Signed by: gardouille
GPG Key ID: E759BAA22501AF32

View File

@ -114,10 +114,14 @@ rm --force -- "${nc_new_version_list}"
rm --force -- "${nc_app_new_version_file}" ; touch -- "${nc_app_new_version_file}" rm --force -- "${nc_app_new_version_file}" ; touch -- "${nc_app_new_version_file}"
printf '%s' "${nc_app_upgrade}" >> "${nc_app_new_version_file}" printf '%s' "${nc_app_upgrade}" >> "${nc_app_new_version_file}"
## If the file exists with a size bigger than 0 ## If the file contains a part of the message if ane upgrade is available
if [ -s "${nc_app_new_version_file}" ]; then ## Example of message if at least one upgrade :
## files_antivirus new version available: 5.5.3
if grep --quiet -- "new version available" "${nc_app_new_version_file}"; then
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG: Apps test — Upgrade seems to be available for apps. Please check ${nc_app_new_version_file}." [ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG: Apps test — Upgrade seems to be available for apps. Please check ${nc_app_new_version_file}."
else else
## Example of message if NO upgrade:
## All apps are up-to-date or no updates could be found
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG: Apps test — All apps seems up-to-date." [ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG: Apps test — All apps seems up-to-date."
rm --force -- "${nc_app_new_version_file}" rm --force -- "${nc_app_new_version_file}"
fi fi