Skip to content

Commit

Permalink
nc-autoupdate-ncp: fix wrong user
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed May 15, 2018
1 parent 191ea16 commit ee92111
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
6 changes: 3 additions & 3 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
6 changes: 3 additions & 3 deletions etc/ncp-config.d/nc-autoupdate-ncp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
22 changes: 15 additions & 7 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

Expand Down

0 comments on commit ee92111

Please sign in to comment.