From ee92111007a81d6443b3ad3d9471deec9cb71742 Mon Sep 17 00:00:00 2001 From: nachoparker Date: Tue, 15 May 2018 06:46:50 +0200 Subject: nc-autoupdate-ncp: fix wrong user --- changelog.md | 6 +++--- etc/ncp-config.d/nc-autoupdate-ncp.sh | 6 +++--- update.sh | 22 +++++++++++++++------- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/changelog.md b/changelog.md index c9baec71..16db7482 100644 --- a/changelog.md +++ b/changelog.md @@ -1,9 +1,9 @@ -[v0.55.4](https://github.com/nextcloud/nextcloudpi/commit/855a996) (2018-05-15) nc-update-netcloud: include version in backup name +[v0.55.4](https://github.com/nextcloud/nextcloudpi/commit/641cc23) (2018-05-15) nc-autoupdate-ncp: fix wrong user -[v0.55.3](https://github.com/nextcloud/nextcloudpi/commit/585518a) (2018-05-15) nc-backup: faster free space calculation. Minimize maintenance mode time +[v0.55.3](https://github.com/nextcloud/nextcloudpi/commit/a57c9f6) (2018-05-15) nc-update-netcloud: include version in backup name -[v0.55.2, master](https://github.com/nextcloud/nextcloudpi/commit/2ab49f4) (2018-05-14) nc-datadir: fix php cli tmpdir +[v0.55.2 ](https://github.com/nextcloud/nextcloudpi/commit/e36a214) (2018-05-15) nc-backup: faster free space calculation. Minimize maintenance mode time [v0.55.1 ](https://github.com/nextcloud/nextcloudpi/commit/a0a1145) (2018-05-14) nc-backup: exclude ncp-update-nc backups diff --git a/etc/ncp-config.d/nc-autoupdate-ncp.sh b/etc/ncp-config.d/nc-autoupdate-ncp.sh index 29467f28..f11dee27 100644 --- a/etc/ncp-config.d/nc-autoupdate-ncp.sh +++ b/etc/ncp-config.d/nc-autoupdate-ncp.sh @@ -14,10 +14,10 @@ # ACTIVE_=no -NOTIFYUSER_=admin +NOTIFYUSER_=ncp DESCRIPTION="Automatically apply NextCloudPlus updates" -configure() +configure() { [[ $ACTIVE_ != "yes" ]] && { rm /etc/cron.daily/ncp-autoupdate @@ -30,7 +30,7 @@ configure() /usr/local/bin/ncp-test-updates && { /usr/local/bin/ncp-update sudo -u www-data php /var/www/nextcloud/occ notification:generate \ - "$NOTIFYUSER_" "NextCloudPlus " \ + "$NOTIFYUSER_" "NextCloudPlus" \ -l "NextCloudPlus was updated to \$( cat /usr/local/etc/ncp-version )" } EOF diff --git a/update.sh b/update.sh index d289179b..0f05d092 100755 --- a/update.sh +++ b/update.sh @@ -120,14 +120,22 @@ done # fix wrong user for notifications DATADIR="$( grep datadirectory /var/www/nextcloud/config/config.php | awk '{ print $3 }' | grep -oP "[^']*[^']" | head -1 )" - F="$CONFDIR"/nc-notify-updates.sh test -d "$DATADIR" && { - [[ -d "$DATADIR"/ncp ]] && [[ ! -d "$DATADIR"/admin ]] \ - && grep -q '^USER_=admin$' "$F" && grep -q '^ACTIVE_=yes$' "$F" && { - sed -i 's|^USER_=admin|USER_=ncp|' "$F" - cd "$CONFDIR" &>/dev/null - activate_script nc-notify-updates.sh - cd - &>/dev/null + [[ -d "$DATADIR"/ncp ]] && [[ ! -d "$DATADIR"/admin ]] && { + F="$CONFDIR"/nc-notify-updates.sh + grep -q '^USER_=admin$' "$F" && grep -q '^ACTIVE_=yes$' "$F" && { + sed -i 's|^USER_=admin|USER_=ncp|' "$F" + cd "$CONFDIR" &>/dev/null + activate_script nc-notify-updates.sh + cd - &>/dev/null + } + F="$CONFDIR"/nc-autoupdate-ncp.sh + grep -q '^NOTIFYUSER_=admin$' "$F" && grep -q '^ACTIVE_=yes$' "$F" && { + sed -i 's|^NOTIFYUSER_=admin|NOTIFYUSER_=ncp|' "$F" + cd "$CONFDIR" &>/dev/null + activate_script nc-autoupdate-ncp.sh + cd - &>/dev/null + } } } -- cgit v1.2.3