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-11-09 15:06:58 +0300
committernachoparker <nacho@ownyourbits.com>2017-11-09 15:07:34 +0300
commit1955ecec9c9cc368b48e14abff60a2be597954c2 (patch)
tree2ea136f5dd40b65de291ab9f8dc137dec7b80284
parent4329eea039f3284f72001b74e0f87232dc016a4f (diff)
nc-notify-updates: fixesv0.32.7
-rw-r--r--changelog.md8
-rw-r--r--etc/nextcloudpi-config.d/nc-notify-updates.sh4
-rwxr-xr-xupdate.sh31
3 files changed, 39 insertions, 4 deletions
diff --git a/changelog.md b/changelog.md
index 2ae408c0..eb3b3ab7 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,9 +1,11 @@
-[v0.32.6](https://github.com/nextcloud/nextcloudpi/commit/83adc32) (2017-11-08) noip: manage many interfaces and fix return value
+[v0.32.7](https://github.com/nextcloud/nextcloudpi/commit/ae1c47a) (2017-11-09) nc-notify-updates: fixes
-[v0.32.5 ](https://github.com/nextcloud/nextcloudpi/commit/f192b20) (2017-11-08) update: wait running apt processes
+[v0.32.6](https://github.com/nextcloud/nextcloudpi/commit/455cb73) (2017-11-08) noip: manage many interfaces and fix return value
-[v0.32.4 ](https://github.com/nextcloud/nextcloudpi/commit/63e0f73) (2017-11-08) fail2ban: update logpath on nc-datadir or nc-restore
+[v0.32.5 ](https://github.com/nextcloud/nextcloudpi/commit/3147047) (2017-11-08) update: wait running apt processes
+
+[v0.32.4 ](https://github.com/nextcloud/nextcloudpi/commit/42cef25) (2017-11-08) fail2ban: update logpath on nc-datadir or nc-restore
[v0.32.3 ](https://github.com/nextcloud/nextcloudpi/commit/bfe0b61) (2017-11-06) nc-notify-updates: rework for more accuracy
diff --git a/etc/nextcloudpi-config.d/nc-notify-updates.sh b/etc/nextcloudpi-config.d/nc-notify-updates.sh
index 5a30ce72..50ff3d6c 100644
--- a/etc/nextcloudpi-config.d/nc-notify-updates.sh
+++ b/etc/nextcloudpi-config.d/nc-notify-updates.sh
@@ -107,7 +107,9 @@ sed -i 's|INFO Packages that will be upgraded:|INFO Packages that will be upgrad
echo -e "Packages automatically upgraded: \$PKGS\\n"
# notify
-sudo -u www-data php /var/www/nextcloud/occ notification:generate "NextCloudPi Unattended Upgrades" -l "Packages automatically upgraded $PKGS"
+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
diff --git a/update.sh b/update.sh
index 08d0af44..03ad5a7e 100755
--- a/update.sh
+++ b/update.sh
@@ -232,6 +232,37 @@ EOF
# relocate noip2 config
mkdir -p /usr/local/etc/noip2
+
+ # fix unattended
+ NUSER=$( grep USER_ /usr/local/etc/nextcloudpi-config.d/nc-notify-updates.sh | head -1 | cut -f2 -d= )
+ 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; }
+
+# find lines with package updates
+LINE=\$( grep "INFO Packages that will be upgraded:" "\$LOGFILE" )
+
+[[ "\$LINE" == "" ]] && { echo "no new upgrades"; exit 0; }
+
+# extract package names
+PKGS=\$( sed 's|^.*Packages that will be upgraded: ||' <<< "\$LINE" | tr '\\n' ' ' )
+
+# mark lines as read
+sed -i 's|INFO Packages that will be upgraded:|INFO Packages that will be upgraded :|' \$LOGFILE
+
+echo -e "Packages automatically upgraded: \$PKGS\\n"
+
+# notify
+sudo -u www-data php /var/www/nextcloud/occ notification:generate \
+ $NUSER "NextCloudPi Unattended Upgrades" \
+ -l "Packages automatically upgraded \$PKGS"
+EOF
+ chmod +x /usr/local/bin/ncp-notify-unattended-upgrade
}
# License