Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/nextcloudpi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthecalcaholic <6317548+theCalcaholic@users.noreply.github.com>2022-09-28 23:21:24 +0300
committerthecalcaholic <6317548+theCalcaholic@users.noreply.github.com>2022-10-03 23:44:00 +0300
commitbcf8b96a902517d35e4d7fa5e73c9cee3abd1f41 (patch)
treef2461eb74013ca6919bd4fdffb4a924e80593e48
parent16741115eeeb2b3e5006c9ebec7d50fa102cc5d2 (diff)
nc-restore.sh: Fix dataless nc-restore deleting data directory if still in /var/www/nextcloud
Signed-off-by: thecalcaholic <6317548+theCalcaholic@users.noreply.github.com>
-rw-r--r--bin/ncp/BACKUPS/nc-restore.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/bin/ncp/BACKUPS/nc-restore.sh b/bin/ncp/BACKUPS/nc-restore.sh
index 36a158cc..375cfd94 100644
--- a/bin/ncp/BACKUPS/nc-restore.sh
+++ b/bin/ncp/BACKUPS/nc-restore.sh
@@ -63,8 +63,18 @@ tar $compress_arg -xf "$BACKUPFILE" -C "$TMPDIR" || exit 1
## RESTORE FILES
echo "restore files..."
+[[ -d "$NCDIR/data" ]] && {
+ DATA_BKP_DIR="$(mktemp -d -p "$NCDIR/.." nc-data-XXXXXX)"
+ mv -T "$NCDIR/data" "$DATA_BKP_DIR/"
+}
rm -rf "$NCDIR"
mv -T "$TMPDIR"/nextcloud "$NCDIR" || { echo "Error restoring base files"; exit 1; }
+if ! [[ -d "$NCDIR/data" ]] && [[ -n "$DATA_BKP_DIR" ]]
+then
+ echo "Restoring $NCDIR/data..."
+ mv -T "$DATA_BKP_DIR" "$NCDIR/data"
+else
+fi
# update NC database password to this instance
sed -i "s|'dbpassword' =>.*|'dbpassword' => '$DBPASSWD',|" /var/www/nextcloud/config/config.php