diff options
-rwxr-xr-x[-rw-r--r--] | bin/ncp-update-nc | 2 | ||||
-rw-r--r-- | changelog.md | 6 | ||||
-rw-r--r-- | etc/ncp-config.d/nc-autoupdate-nc.sh | 59 |
3 files changed, 64 insertions, 3 deletions
diff --git a/bin/ncp-update-nc b/bin/ncp-update-nc index 413da12d..8b787c35 100644..100755 --- a/bin/ncp-update-nc +++ b/bin/ncp-update-nc @@ -57,7 +57,7 @@ fi echo "Current Nextcloud version $CURRENT" echo "Available Nextcloud version $VER" -[[ "$NEED_UPDATE" == "true" ]] || { echo "Nothing to update"; exit 0; } +[[ "$NEED_UPDATE" == "true" ]] || { echo "Nothing to update"; exit 1; } # cleanup #################### diff --git a/changelog.md b/changelog.md index 16db7482..d18ac594 100644 --- a/changelog.md +++ b/changelog.md @@ -1,7 +1,9 @@ -[v0.55.4](https://github.com/nextcloud/nextcloudpi/commit/641cc23) (2018-05-15) nc-autoupdate-ncp: fix wrong user +[v0.56.0](https://github.com/nextcloud/nextcloudpi/commit/febbb00) (2018-05-15) added nc-autoupdate-nc -[v0.55.3](https://github.com/nextcloud/nextcloudpi/commit/a57c9f6) (2018-05-15) nc-update-netcloud: include version in backup name +[v0.55.4](https://github.com/nextcloud/nextcloudpi/commit/ef88be9) (2018-05-15) nc-autoupdate-ncp: fix wrong user + +[v0.55.3 ](https://github.com/nextcloud/nextcloudpi/commit/a57c9f6) (2018-05-15) nc-update-netcloud: include version in backup name [v0.55.2 ](https://github.com/nextcloud/nextcloudpi/commit/e36a214) (2018-05-15) nc-backup: faster free space calculation. Minimize maintenance mode time diff --git a/etc/ncp-config.d/nc-autoupdate-nc.sh b/etc/ncp-config.d/nc-autoupdate-nc.sh new file mode 100644 index 00000000..6d775ab8 --- /dev/null +++ b/etc/ncp-config.d/nc-autoupdate-nc.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +# Automatically apply Nextcloud updates +# +# Copyleft 2018 by Ignacio Nunez Hernanz <nacho _a_t_ ownyourbits _d_o_t_ com> +# GPL licensed (see end of file) * Use at your own risk! +# +# Usage: +# +# ./installer.sh nc-autoupdate-nc.sh <IP> +# +# See installer.sh instructions for details +# More at: https://ownyourbits.com +# + +ACTIVE_=no +NOTIFYUSER_=ncp +DESCRIPTION="Automatically apply Nextcloud updates" +VERSION=13.0.2 + +configure() +{ + [[ $ACTIVE_ != "yes" ]] && { + rm /etc/cron.daily/ncp-autoupdate-nc + echo "automatic Nextcloud updates disabled" + return 0 + } + + cat > /etc/cron.daily/ncp-autoupdate-nc <<EOF +#!/bin/bash +/usr/local/bin/ncp-update-nc "$VERSION" && { + VER="\$( sudo -u www-data php /var/www/nextcloud/occ status | grep "version:" | awk '{ print \$3 }' )" + sudo -u www-data php /var/www/nextcloud/occ notification:generate \ + "$NOTIFYUSER_" "NextCloudPlus" -l "Nextcloud was updated to \$VER" +} +EOF + chmod a+x /etc/cron.daily/ncp-autoupdate-nc + echo "automatic Nextcloud updates enabled" +} + +install() { :; } + +# License +# +# This script is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This script is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this script; if not, write to the +# Free Software Foundation, Inc., 59 Temple Place, Suite 330, +# Boston, MA 02111-1307 USA + |