Skip to content

Commit

Permalink
added nc-autoupdate-nc
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed May 15, 2018
1 parent ee92111 commit 9bd6f81
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bin/ncp-update-nc
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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
####################
Expand Down
6 changes: 4 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
59 changes: 59 additions & 0 deletions etc/ncp-config.d/nc-autoupdate-nc.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9bd6f81

Please sign in to comment.