nextcloudpi/bin/ncp-check-nc-version
Tobias K 323a202785
ncp-update-nc, nc-autoupdate-nc, ncp-check-nc-version: Dynamically determine upgrade path and auto-upgrade to latest minor version
Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com>
2024-07-28 19:14:51 +02:00

26 lines
702 B
Bash
Executable File

#!/bin/bash
# notify latest available NC version
set -e
source /usr/local/etc/library.sh # sets NCLATESTVER
CURRENT="$(nc_version)"
NEXT_VERSION="$(determine_nc_upgrade_version "${CURRENT}" "${NCLATESTVER?}")"
[[ -n "$NEXT_VERSION" ]] || exit 0
NOTIFIED=/var/run/.nc-version-notified
test -e "${NOTIFIED}" && [[ "${NEXT_VERSION}" == "$( cat "${NOTIFIED}" )" ]] && {
echo "Found update from ${CURRENT} to ${NEXT_VERSION}. Already notified"
exit 0
}
if is_more_recent_than "${NEXT_VERSION}" "${CURRENT}"; then
notify_admin \
"Nextcloud update" \
"Update from ${CURRENT} to ${NEXT_VERSION} is available. Update from https://$(get_ip):4443"
echo "${NEXT_VERSION}" > "${NOTIFIED}"
fi