Bug fixing on restore

This commit is contained in:
John
2025-04-27 20:53:26 +12:00
parent acb462d15e
commit 5bc7a05a46
2 changed files with 11 additions and 2 deletions

View File

@ -24,13 +24,14 @@ bash ./uninstall.sh || die "Failed to uninstall service before restore"
# Remove existing data folder
echo "Deleting ALL data in $LOCAL_DATA_FOLDER."
rm -rf "$LOCAL_DATA_FOLDER"
_root_remove_tree "$LOCAL_DATA_FOLDER"
[ ! -d "$LOCAL_DATA_FOLDER" ] || die "Failed to delete $LOCAL_DATA_FOLDER"
mkdir -p "$LOCAL_DATA_FOLDER"
[ -d "$LOCAL_DATA_FOLDER" ] || die "Failed to create $LOCAL_DATA_FOLDER"
# Restore data folder from backup
if ! tar xzvf "$BACKUP_FILE" -C "$LOCAL_DATA_FOLDER"; then
# --strip-components=1 removes the parent folder in the tgz from the restore paths.
if ! tar xzvf --strip-components=1 "$BACKUP_FILE" -C "$LOCAL_DATA_FOLDER"; then
die "Failed to restore data folder from backup"
fi