diff options
author | nachoparker <nacho@ownyourbits.com> | 2018-01-06 13:00:49 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2018-01-06 23:39:20 +0300 |
commit | 459fe3916687b5762a003d1e42ba4a888e2eecc2 (patch) | |
tree | 395df63fd2c4f013b503d2e5ded4b4ff5edd8991 /etc/nextcloudpi-config.d | |
parent | 3beff63189925676a4382a40b58d69cda968fdc1 (diff) |
nc-restore: restore to a btrfs subvolumev0.44.8
Diffstat (limited to 'etc/nextcloudpi-config.d')
-rw-r--r-- | etc/nextcloudpi-config.d/nc-restore.sh | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/etc/nextcloudpi-config.d/nc-restore.sh b/etc/nextcloudpi-config.d/nc-restore.sh index fc2033d7..fd21846d 100644 --- a/etc/nextcloudpi-config.d/nc-restore.sh +++ b/etc/nextcloudpi-config.d/nc-restore.sh @@ -95,11 +95,18 @@ EOF [[ -e "$DATADIR" ]] && { echo "backing up existing $DATADIR" - mv "$DATADIR" "$DATADIR-$( date "+%m-%d-%y" )" + mv "$DATADIR" "$DATADIR-$( date "+%m-%d-%y" )" || return 1 } - mkdir -p "$( dirname "$DATADIR" )" - mv "$TMPDIR/$( basename "$DATADIR" )" "$DATADIR" + mkdir -p "$DATADIR" + [[ "$( stat -fc%T "$DATADIR" )" == "btrfs" ]] && { + rmdir "$DATADIR" || return 1 + btrfs subvolume create "$DATADIR" || return 1 + } + chown www-data:www-data "$DATADIR" + local TMPDATA="$TMPDIR/$( basename "$DATADIR" )" + mv "$TMPDATA"/* "$TMPDATA"/.[!.]* "$DATADIR" || return 1 + rmdir "$TMPDATA" || return 1 sudo -u www-data php occ maintenance:mode --off |