Skip to content

Commit

Permalink
nc-restore: refuse to restore from /var/www/nextcloud
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed May 15, 2018
1 parent 88dcfef commit 741e79a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 4 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@

[v0.56.1](https://github.com/nextcloud/nextcloudpi/commit/ef49d0e) (2018-05-15) nc-update-nextcloud: rollback in case of power cut
[v0.56.2](https://github.com/nextcloud/nextcloudpi/commit/550f96a) (2018-05-15) nc-restore: refuse to restore from /var/www/nextcloud

[v0.56.0](https://github.com/nextcloud/nextcloudpi/commit/3c56aa8) (2018-05-15) added nc-autoupdate-nc
[v0.56.1](https://github.com/nextcloud/nextcloudpi/commit/06f1d5c) (2018-05-15) nc-update-nextcloud: rollback in case of power cut

[v0.56.0 ](https://github.com/nextcloud/nextcloudpi/commit/0248ba3) (2018-05-15) added nc-autoupdate-nc

[v0.55.4 ](https://github.com/nextcloud/nextcloudpi/commit/ef88be9) (2018-05-15) nc-autoupdate-ncp: fix wrong user

Expand Down
9 changes: 6 additions & 3 deletions etc/ncp-config.d/nc-restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,12 @@ BACKUPFILE="$1"
DBADMIN=ncadmin
DBPASSWD="$( grep password /root/.my.cnf | sed 's|password=||' )"
[ $# -eq 0 ] && { echo "missing first argument"; exit 1; }
[ -f "$BACKUPFILE" ] || { echo "$BACKUPFILE not found" ; exit 1; }
[ -d /var/www/nextcloud ] && { echo "INFO: overwriting old instance"; }
DIR="$( cd "$( dirname "$BACKUPFILE" )" &>/dev/null && pwd )" #abspath
[[ $# -eq 0 ]] && { echo "missing first argument" ; exit 1; }
[[ -f "$BACKUPFILE" ]] || { echo "$BACKUPFILE not found" ; exit 1; }
[[ "$DIR" =~ "/var/www/nextcloud" ]] && { echo "Refusing to restore from /var/www/nextcloud"; exit 1; }
[[ -d /var/www/nextcloud ]] && { echo "INFO: overwriting old instance"; }
TMPDIR="$( mktemp -d "$( dirname "$BACKUPFILE" )"/ncp-restore.XXXXXX )" || { echo "Failed to create temp dir" >&2; exit 1; }
TMPDIR="$( cd "$TMPDIR" &>/dev/null && pwd )" || { echo "$TMPDIR not found"; exit 1; } #abspath
Expand Down

0 comments on commit 741e79a

Please sign in to comment.