From d0ca44a6fcf1a5426de27f49fd43891d04d0f223 Mon Sep 17 00:00:00 2001 From: nachoparker Date: Wed, 16 Jan 2019 19:27:00 -0700 Subject: [PATCH] docker: support for ncp-update-nc --- bin/ncp-update-nc | 20 +++++++++----------- changelog.md | 6 ++++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/bin/ncp-update-nc b/bin/ncp-update-nc index 116326033..8d5c81498 100755 --- a/bin/ncp-update-nc +++ b/bin/ncp-update-nc @@ -23,9 +23,8 @@ VER="$1" # pre-checks #################### -[[ -f /.docker-image ]] && { echo "This feature is still not available for docker containers"; exit 1; } - -cd /var/www/ +[[ -f /.docker-image ]] && BASEDIR=/data || BASEDIR=/var/www/ +cd "$BASEDIR" DATADIR="$( grep datadirectory nextcloud/config/config.php | awk '{ print $3 }' | grep -oP "[^']*[^']" | head -1 )" [[ -d /var/www/nextcloud-old ]] && { echo "Nextcloud backup directory found. Interrupted installation?"; exit 1; } [[ -d /var/www/nextcloud ]] || { echo "Nextcloud directory not found" ; exit 1; } @@ -73,7 +72,7 @@ cleanup() { local RET=$? set +eE echo "Clean up..." - rm -rf /var/www/nextcloud.tar.bz2 /var/www/nextcloud-old + rm -rf "$BASEDIR"/nextcloud.tar.bz2 "$BASEDIR"/nextcloud-old trap "" EXIT exit $RET } @@ -111,8 +110,8 @@ rollback_simple() { set +eE trap "" INT TERM HUP ERR echo -e "Abort\nSimple roll back..." - rm -rf /var/www/nextcloud - mv /var/www/nextcloud-old /var/www/nextcloud + rm -rf "$BASEDIR"/nextcloud + mv "$BASEDIR"/nextcloud-old "$BASEDIR"/nextcloud false || cleanup # so cleanup exits with 1 } trap rollback_simple INT TERM HUP ERR @@ -146,7 +145,7 @@ done # copy data if it was at the default location #################### -[[ "$DATADIR" == "/var/www/nextcloud/data" ]] && { +[[ "$DATADIR" == ""$BASEDIR"/nextcloud/data" ]] && { echo "Restore data..." mv -T nextcloud-old/data nextcloud/data } @@ -157,12 +156,12 @@ rollback() { set +eE trap "" INT TERM HUP ERR EXIT echo -e "Abort\nClean up..." - rm -rf /var/www/nextcloud.tar.bz2 /var/www/nextcloud-old + rm -rf /var/www/nextcloud.tar.bz2 "$BASEDIR"/nextcloud-old echo "Rolling back to backup $BKP..." local TMPDATA="$( mktemp -d "/var/www/ncp-data.XXXXXX" )" || { echo "Failed to create temp dir" >&2; exit 1; } - [[ "$DATADIR" == "/var/www/nextcloud/data" ]] && mv -T "$DATADIR" "$TMPDATA" + [[ "$DATADIR" == "$BASEDIR/nextcloud/data" ]] && mv -T "$DATADIR" "$TMPDATA" ncp-restore "$BKP" || { echo "Rollback failed! Data left at $TMPDATA"; exit 1; } - [[ "$DATADIR" == "/var/www/nextcloud/data" ]] && { rm -rf "$DATADIR"; mv -T "$TMPDATA" "$DATADIR"; } + [[ "$DATADIR" == "$BASEDIR/nextcloud/data" ]] && { rm -rf "$DATADIR"; mv -T "$TMPDATA" "$DATADIR"; } rm "$BKP" echo "Rollback successful. Nothing was updated" exit 1 @@ -189,4 +188,3 @@ mv "$BKP" "$DATADIR"/ncp-update-backups chown -R www-data:www-data "$DATADIR"/ncp-update-backups BKP="$DATADIR"/ncp-update-backups/"$( basename "$BKP" )" echo "Backup stored at $BKP" - diff --git a/changelog.md b/changelog.md index 5c56cedb0..9dc164972 100644 --- a/changelog.md +++ b/changelog.md @@ -1,7 +1,9 @@ -[v1.4.0](https://github.com/nextcloud/nextcloudpi/commit/2bd3e67) (2019-01-16) add nc-trusted-domains +[v1.4.1](https://github.com/nextcloud/nextcloudpi/commit/9e0c100) (2019-01-16) docker: support for ncp-update-nc -[v1.3.11](https://github.com/nextcloud/nextcloudpi/commit/84ac075) (2019-01-16) nc-backup: parallel compression +[v1.4.0](https://github.com/nextcloud/nextcloudpi/commit/1dd1bb7) (2019-01-16) add nc-trusted-domains + +[v1.3.11 ](https://github.com/nextcloud/nextcloudpi/commit/84ac075) (2019-01-16) nc-backup: parallel compression [v1.3.10 ](https://github.com/nextcloud/nextcloudpi/commit/2419e57) (2019-01-15) nc-backup: compress in place and exclude previews folder