Skip to content

Commit

Permalink
nc-notify-updates: fix wrong user
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed May 10, 2018
1 parent 6dc636d commit 09741e1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
4 changes: 3 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

[v0.54.5](https://github.com/nextcloud/nextcloudpi/commit/3f6f865) (2018-05-10) armbian: fix mDNS
[v0.54.6](https://github.com/nextcloud/nextcloudpi/commit/1588d46) (2018-05-10) nc-notify-updates: fix wrong default user

[v0.54.5](https://github.com/nextcloud/nextcloudpi/commit/ee05dbc) (2018-05-10) armbian: fix mDNS

[v0.54.4](https://github.com/nextcloud/nextcloudpi/commit/36f4c6f) (2018-05-09) avoid temp dir vulnerabilities

Expand Down
2 changes: 1 addition & 1 deletion etc/ncp-config.d/nc-notify-updates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#

ACTIVE_=yes
USER_=admin
USER_=ncp

DESCRIPTION="Notify in NC when a NextCloudPlus update is available"

Expand Down
15 changes: 15 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,28 @@ done
wget -q https://raw.githubusercontent.com/nachoparker/btrfs-sync/master/btrfs-sync -O /usr/local/bin/btrfs-sync
chmod +x /usr/local/bin/btrfs-sync

# for non docker images
[[ ! -f /.docker-image ]] && {
# install avahi-daemon in armbian images
[[ -f /lib/systemd/system/avahi-daemon.service ]] || {
apt-get update
apt-get install -y --no-install-recommends avahi-daemon
}
}

# 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
}
}

} # end - only live updates

exit 0
Expand Down

0 comments on commit 09741e1

Please sign in to comment.