nextcloudpi/bin/ncp-check-nc-version
Tobias Knöppler e5113f4601
library.sh: Respect requested NC version in determine_nc_update_version
Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com>
2024-08-23 13:55:35 +02:00

26 lines
701 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_update_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