diff options
-rw-r--r-- | changelog.md | 8 | ||||
-rw-r--r-- | etc/nextcloudpi-config.d/nc-notify-updates.sh | 4 | ||||
-rwxr-xr-x | update.sh | 31 |
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 @@ -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 |