Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/nextcloudpi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornachoparker <nacho@ownyourbits.com>2021-10-04 23:55:38 +0300
committernachoparker <nacho@ownyourbits.com>2021-10-05 00:13:02 +0300
commita0728d748789eae7ccb42433bbde194cec319790 (patch)
tree90d132c91f96993f4413ae204f202744857158b5
parent20370640c7af3eb06c99cf56307a9553610ef1e7 (diff)
nc-notify-updates: notify of new supported NC versionsv1.40.0
Signed-off-by: nachoparker <nacho@ownyourbits.com>
-rwxr-xr-xbin/ncp-check-nc-version16
-rwxr-xr-xbin/ncp-update-nc19
-rw-r--r--bin/ncp/CONFIG/nc-init.sh3
-rw-r--r--bin/ncp/UPDATES/nc-notify-updates.sh16
-rw-r--r--changelog.md4
-rw-r--r--updates/1.40.0.sh4
6 files changed, 36 insertions, 26 deletions
diff --git a/bin/ncp-check-nc-version b/bin/ncp-check-nc-version
new file mode 100755
index 00000000..97ed40f9
--- /dev/null
+++ b/bin/ncp-check-nc-version
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+# notify latest available NC version
+
+set -e
+
+source /usr/local/etc/library.sh # sets NCLATESTVER
+
+CURRENT="$(ncc status | grep "version:" | awk '{ print $3 }')"
+LATEST="$(wget -qO- https://raw.githubusercontent.com/nextcloud/nextcloudpi/master/etc/ncp.cfg | jq -r .nextcloud_version)"
+
+if is_more_recent_than "${LATEST}" "${CURRENT}"; then
+ notify_admin \
+ "Nextcloud update" \
+ "Update from ${CURRENT} to "${LATEST}" is available. Update from https://$(get_ip):4443"
+fi
diff --git a/bin/ncp-update-nc b/bin/ncp-update-nc
index 50f6379b..9908edc7 100755
--- a/bin/ncp-update-nc
+++ b/bin/ncp-update-nc
@@ -45,26 +45,9 @@ CURRENT="$( $SUDO php /var/www/nextcloud/occ status | grep "version:" | awk '{ p
grep -qP "\d+\.\d+\.\d+" <<<"$CURRENT" || { echo "Malformed version $CURRENT"; exit 1; }
grep -qP "\d+\.\d+\.\d+" <<<"$VER" || { echo "Malformed version $VER" ; exit 1; }
-MAJOR=$( grep -oP "\d+\.\d+\.\d+" <<<"$VER" | cut -d. -f1 )
-MINOR=$( grep -oP "\d+\.\d+\.\d+" <<<"$VER" | cut -d. -f2 )
-PATCH=$( grep -oP "\d+\.\d+\.\d+" <<<"$VER" | cut -d. -f3 )
-
-MAJ=$( grep -oP "\d+\.\d+\.\d+" <<<"$CURRENT" | cut -d. -f1 )
-MIN=$( grep -oP "\d+\.\d+\.\d+" <<<"$CURRENT" | cut -d. -f2 )
-PAT=$( grep -oP "\d+\.\d+\.\d+" <<<"$CURRENT" | cut -d. -f3 )
-
-NEED_UPDATE=false
-if [ "$MAJOR" -gt "$MAJ" ]; then
- NEED_UPDATE=true
-elif [ "$MAJOR" -eq "$MAJ" ] && [ "$MINOR" -gt "$MIN" ]; then
- NEED_UPDATE=true
-elif [ "$MAJOR" -eq "$MAJ" ] && [ "$MINOR" -eq "$MIN" ] && [ "$PATCH" -gt "$PAT" ]; then
- NEED_UPDATE=true
-fi
-
echo "Current Nextcloud version $CURRENT"
echo "Available Nextcloud version $VER"
-[[ "$NEED_UPDATE" == "true" ]] || { echo "Nothing to update"; exit 1; } # we want `exit 1` so the autoupdate doesn't notify success in this case
+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
# make sure that cron.php is not running and there are no pending jobs
# https://github.com/nextcloud/server/issues/10949
diff --git a/bin/ncp/CONFIG/nc-init.sh b/bin/ncp/CONFIG/nc-init.sh
index 0df7c3c8..17cf2f9e 100644
--- a/bin/ncp/CONFIG/nc-init.sh
+++ b/bin/ncp/CONFIG/nc-init.sh
@@ -148,6 +148,9 @@ EOF
ncc app:install tasks
ncc app:enable tasks
+ # we handle this ourselves
+ ncc app:disable updatenotification
+
# News dropped support for 32-bit -> https://github.com/nextcloud/news/issues/1423
if ! [[ "$(uname -m)" =~ "armv7" ]]; then
ncc app:install news
diff --git a/bin/ncp/UPDATES/nc-notify-updates.sh b/bin/ncp/UPDATES/nc-notify-updates.sh
index de239f13..501d2fee 100644
--- a/bin/ncp/UPDATES/nc-notify-updates.sh
+++ b/bin/ncp/UPDATES/nc-notify-updates.sh
@@ -23,28 +23,30 @@ configure()
}
# code
- cat > /usr/local/bin/ncp-notify-update <<EOF
+ cat > /usr/local/bin/ncp-notify-update <<'EOF'
#!/bin/bash
source /usr/local/etc/library.sh
VERFILE=/usr/local/etc/ncp-version
LATEST=/var/run/.ncp-latest-version
NOTIFIED=/var/run/.ncp-version-notified
-test -e \$LATEST || exit 0;
+/usr/local/bin/ncp-check-nc-version
+
+test -e $LATEST || exit 0;
/usr/local/bin/ncp-test-updates || { echo "NextCloudPi up to date"; exit 0; }
-test -e \$NOTIFIED && [[ "\$( cat \$LATEST )" == "\$( cat \$NOTIFIED )" ]] && {
- echo "Found update from \$( cat \$VERFILE ) to \$( cat \$LATEST ). Already notified"
+test -e $NOTIFIED && [[ "$( cat $LATEST )" == "$( cat $NOTIFIED )" ]] && {
+ echo "Found update from $( cat $VERFILE ) to $( cat $LATEST ). Already notified"
exit 0
}
-echo "Found update from \$( cat \$VERFILE ) to \$( cat \$LATEST ). Sending notification..."
+echo "Found update from $( cat $VERFILE ) to $( cat $LATEST ). Sending notification..."
notify_admin \
"NextCloudPi update" \
- "Update from \$( cat \$VERFILE ) to \$( cat \$LATEST ) is available. Update from https://\$(get_ip):4443"
+ "Update from $( cat $VERFILE ) to $( cat $LATEST ) is available. Update from https://$(get_ip):4443"
-cat \$LATEST > \$NOTIFIED
+cat $LATEST > $NOTIFIED
EOF
chmod +x /usr/local/bin/ncp-notify-update
diff --git a/changelog.md b/changelog.md
index df5de105..017ec95c 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,7 @@
-[v1.39.21](https://github.com/nextcloud/nextcloudpi/commit/a4fdff6) (2021-10-04) ncp-web: disable activation page once activated
+[v1.40.0](https://github.com/nextcloud/nextcloudpi/commit/fbc4ab8) (2021-10-04) nc-notify-updates: notify of new supported NC versions
+
+[v1.39.21](https://github.com/nextcloud/nextcloudpi/commit/2037064) (2021-10-04) ncp-web: disable activation page once activated
[v1.39.20](https://github.com/nextcloud/nextcloudpi/commit/714c3e5) (2021-10-04) ncp-config: fix first time error with no known latest version
diff --git a/updates/1.40.0.sh b/updates/1.40.0.sh
index 71312587..53aa6600 100644
--- a/updates/1.40.0.sh
+++ b/updates/1.40.0.sh
@@ -50,6 +50,10 @@ EOF
chmod +x /usr/local/bin/ncc
fi
+# we handle this ourselves now
+ncc app:disable updatenotification
+run_app nc-notify-updates
+
# docker images only
[[ -f /.docker-image ]] && {
: