# Check if the current version is the last one {{{
if [ "${nc_current_version}" != "${nc_new_version}" ]; then
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG: Test version — Current version (${nc_current_version}) and latest available (${nc_new_version}) seems to be different."
## If it's a minor release for stable or a new stable version {{{
if [ "${nc_current_major}" -le "${nc_new_major}" ]; then
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG: Test release major — A minor or major upgrade needs to be apply."
### Create a temp file to monitor
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}"
## }}}
## It's an upgrade for a previous major release {{{
else
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG: Test release major — It looks like an upgrade for a previous major release."
[ "${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
[ "${DEBUG}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG: Apps test — All apps seems up-to-date."