File tree Expand file tree Collapse file tree 6 files changed +36
-26
lines changed
Expand file tree Collapse file tree 6 files changed +36
-26
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # notify latest available NC version
4+
5+ set -e
6+
7+ source /usr/local/etc/library.sh # sets NCLATESTVER
8+
9+ CURRENT=" $( ncc status | grep " version:" | awk ' { print $3 }' ) "
10+ LATEST=" $( wget -qO- https://raw.githubusercontent.com/nextcloud/nextcloudpi/master/etc/ncp.cfg | jq -r .nextcloud_version) "
11+
12+ if is_more_recent_than " ${LATEST} " " ${CURRENT} " ; then
13+ notify_admin \
14+ " Nextcloud update" \
15+ " Update from ${CURRENT} to " ${LATEST} " is available. Update from https://$( get_ip) :4443"
16+ fi
Original file line number Diff line number Diff line change @@ -45,26 +45,9 @@ CURRENT="$( $SUDO php /var/www/nextcloud/occ status | grep "version:" | awk '{ p
4545grep -qP " \d+\.\d+\.\d+" <<< " $CURRENT" || { echo " Malformed version $CURRENT " ; exit 1; }
4646grep -qP " \d+\.\d+\.\d+" <<< " $VER" || { echo " Malformed version $VER " ; exit 1; }
4747
48- MAJOR=$( grep -oP " \d+\.\d+\.\d+" <<< " $VER" | cut -d. -f1 )
49- MINOR=$( grep -oP " \d+\.\d+\.\d+" <<< " $VER" | cut -d. -f2 )
50- PATCH=$( grep -oP " \d+\.\d+\.\d+" <<< " $VER" | cut -d. -f3 )
51-
52- MAJ=$( grep -oP " \d+\.\d+\.\d+" <<< " $CURRENT" | cut -d. -f1 )
53- MIN=$( grep -oP " \d+\.\d+\.\d+" <<< " $CURRENT" | cut -d. -f2 )
54- PAT=$( grep -oP " \d+\.\d+\.\d+" <<< " $CURRENT" | cut -d. -f3 )
55-
56- NEED_UPDATE=false
57- if [ " $MAJOR " -gt " $MAJ " ]; then
58- NEED_UPDATE=true
59- elif [ " $MAJOR " -eq " $MAJ " ] && [ " $MINOR " -gt " $MIN " ]; then
60- NEED_UPDATE=true
61- elif [ " $MAJOR " -eq " $MAJ " ] && [ " $MINOR " -eq " $MIN " ] && [ " $PATCH " -gt " $PAT " ]; then
62- NEED_UPDATE=true
63- fi
64-
6548echo " Current Nextcloud version $CURRENT "
6649echo " Available Nextcloud version $VER "
67- [[ " $NEED_UPDATE " == " true " ]] || { echo " Nothing to update" ; exit 1; } # we want `exit 1` so the autoupdate doesn't notify success in this case
50+ is_more_recent_than " ${VER} " " ${CURRENT} " || { echo " Nothing to update" ; exit 1; } # we want `exit 1` so the autoupdate doesn't notify success in this case
6851
6952# make sure that cron.php is not running and there are no pending jobs
7053# https://github.com/nextcloud/server/issues/10949
Original file line number Diff line number Diff line change 148148 ncc app:install tasks
149149 ncc app:enable tasks
150150
151+ # we handle this ourselves
152+ ncc app:disable updatenotification
153+
151154 # News dropped support for 32-bit -> https://github.com/nextcloud/news/issues/1423
152155 if ! [[ " $( uname -m) " =~ " armv7" ]]; then
153156 ncc app:install news
Original file line number Diff line number Diff line change @@ -23,28 +23,30 @@ configure()
2323 }
2424
2525 # code
26- cat > /usr/local/bin/ncp-notify-update << EOF
26+ cat > /usr/local/bin/ncp-notify-update << ' EOF '
2727#!/bin/bash
2828source /usr/local/etc/library.sh
2929VERFILE=/usr/local/etc/ncp-version
3030LATEST=/var/run/.ncp-latest-version
3131NOTIFIED=/var/run/.ncp-version-notified
3232
33- test -e \$ LATEST || exit 0;
33+ /usr/local/bin/ncp-check-nc-version
34+
35+ test -e $LATEST || exit 0;
3436/usr/local/bin/ncp-test-updates || { echo "NextCloudPi up to date"; exit 0; }
3537
36- test -e \ $ NOTIFIED && [[ "\ $ ( cat \ $ LATEST )" == "\ $ ( cat \ $ NOTIFIED )" ]] && {
37- echo "Found update from \ $ ( cat \ $ VERFILE ) to \ $ ( cat \ $ LATEST ). Already notified"
38+ test -e $NOTIFIED && [[ "$( cat $LATEST )" == "$( cat $NOTIFIED )" ]] && {
39+ echo "Found update from $( cat $VERFILE ) to $( cat $LATEST ). Already notified"
3840 exit 0
3941}
4042
41- echo "Found update from \ $ ( cat \ $ VERFILE ) to \ $ ( cat \ $ LATEST ). Sending notification..."
43+ echo "Found update from $( cat $VERFILE ) to $( cat $LATEST ). Sending notification..."
4244
4345notify_admin \
4446 "NextCloudPi update" \
45- "Update from \ $ ( cat \ $ VERFILE ) to \ $ ( cat \ $ LATEST ) is available. Update from https://\ $ (get_ip):4443"
47+ "Update from $( cat $VERFILE ) to $( cat $LATEST ) is available. Update from https://$(get_ip):4443"
4648
47- cat \ $ LATEST > \ $ NOTIFIED
49+ cat $LATEST > $NOTIFIED
4850EOF
4951 chmod +x /usr/local/bin/ncp-notify-update
5052
Original file line number Diff line number Diff line change 11
2- [ v1.39.21] ( https://github.com/nextcloud/nextcloudpi/commit/a4fdff6 ) (2021-10-04) ncp-web: disable activation page once activated
2+ [ v1.40.0] ( https://github.com/nextcloud/nextcloudpi/commit/fbc4ab8 ) (2021-10-04) nc-notify-updates: notify of new supported NC versions
3+
4+ [ v1.39.21] ( https://github.com/nextcloud/nextcloudpi/commit/2037064 ) (2021-10-04) ncp-web: disable activation page once activated
35
46[ v1.39.20] ( https://github.com/nextcloud/nextcloudpi/commit/714c3e5 ) (2021-10-04) ncp-config: fix first time error with no known latest version
57
Original file line number Diff line number Diff line change 5050 chmod +x /usr/local/bin/ncc
5151fi
5252
53+ # we handle this ourselves now
54+ ncc app:disable updatenotification
55+ run_app nc-notify-updates
56+
5357# docker images only
5458[[ -f /.docker-image ]] && {
5559 :
You can’t perform that action at this time.
0 commit comments