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>2017-10-26 13:17:28 +0300
committernachoparker <nacho@ownyourbits.com>2017-10-26 13:17:51 +0300
commitd8b6eb38672505d5169dbdb463180f6da8740441 (patch)
tree4d93eb62338faa5a075ab2025662143bbd4e1290
parent2f1a9c99e9953713829b6f38d581a41f3771e7bc (diff)
nc-notify-updates: fix repeated linesv0.31.20
-rw-r--r--etc/nextcloudpi-config.d/nc-notify-updates.sh2
-rwxr-xr-xupdate.sh28
2 files changed, 29 insertions, 1 deletions
diff --git a/etc/nextcloudpi-config.d/nc-notify-updates.sh b/etc/nextcloudpi-config.d/nc-notify-updates.sh
index e85912ca..f0a5428f 100644
--- a/etc/nextcloudpi-config.d/nc-notify-updates.sh
+++ b/etc/nextcloudpi-config.d/nc-notify-updates.sh
@@ -96,7 +96,7 @@ test -e "\$STAMPFILE" || touch "\$STAMPFILE"
[ \$( date -r "\$LOGFILE" +'%y%m%d%H%M' ) -le \$( date -r "\$STAMPFILE" +'%y%m%d%H%M' ) ] && { echo "info is up to date"; exit 0; }
-LINE=\$( grep "INFO Packages that will be upgraded" "\$LOGFILE" )
+LINE=\$( grep "INFO Packages that will be upgraded" "\$LOGFILE" | tail -1 )
[[ "\$LINE" == "" ]] && { echo "no new upgrades"; touch "\$STAMPFILE"; exit 0; }
diff --git a/update.sh b/update.sh
index f28e07b8..83e51580 100755
--- a/update.sh
+++ b/update.sh
@@ -176,6 +176,34 @@ EOF
grep -q actionstop_ "$F" || sed -i 's|actionstop|actionstop_|' "$F"
type whois &>/dev/null || { apt-get update; apt-get install --no-install-recommends -y whois; }
+ # fix notify unattended upgrades repeating lines
+ cat > /usr/local/bin/ncp-notify-unattended-upgrade <<EOF
+#!/bin/bash
+LOGFILE=/var/log/unattended-upgrades/unattended-upgrades.log
+STAMPFILE=/var/run/.ncp-notify-unattended-upgrades
+VERFILE=/usr/local/etc/ncp-version
+
+test -e "\$LOGFILE" || { echo "\$LOGFILE not found"; exit 1; }
+
+test -e "\$STAMPFILE" || touch "\$STAMPFILE"
+
+[ \$( date -r "\$LOGFILE" +'%y%m%d%H%M' ) -le \$( date -r "\$STAMPFILE" +'%y%m%d%H%M' ) ] && { echo "info is up to date"; exit 0; }
+
+LINE=\$( grep "INFO Packages that will be upgraded" "\$LOGFILE" | tail -1 )
+
+[[ "\$LINE" == "" ]] && { echo "no new upgrades"; touch "\$STAMPFILE"; exit 0; }
+
+PKGS=\$( sed 's|^.*Packages that will be upgraded: ||' <<< "\$LINE" )
+
+echo "Packages automatically upgraded: \$PKGS"
+
+touch "\$STAMPFILE"
+
+sudo -u www-data php /var/www/nextcloud/occ notification:generate \
+ $USER_ "NextCloudPi Unattended Upgrades" \
+ -l "Packages automatically upgraded \$PKGS"
+EOF
+ chmod +x /usr/local/bin/ncp-notify-unattended-upgrade
}
# License