diff --git a/restore-volumes.sh b/restore-volumes.sh index 66e55faa..debae650 100755 --- a/restore-volumes.sh +++ b/restore-volumes.sh @@ -117,17 +117,26 @@ while IFS= read -r key; do echo "No /backup cache: streaming + extracting $newest_file directly" curl --ipv4 -# "${remote_source}${newest_file}" | zstd -d | tar -xf - --keep-directory-symlink -C / if [ $? -ne 0 ]; then - echo "Error processing $newest_file" + echo "Error processing $newest_file" >&2 exit 1 fi else - if [ ! -e "$backup_dir/$(basename "$newest_file")" ]; then + backup_file="$backup_dir/$(basename "$newest_file")" + if [ ! -e "$backup_file" ] || [ -e "${backup_file}.aria2" ]; then aria2c -c -Z -x8 -j8 -s8 -d "$backup_dir" "${remote_source}${newest_file}" fi - tar -I zstd -xf "$backup_dir/$(basename "$newest_file")" --keep-directory-symlink -C / + tar -I zstd -xf "$backup_file" --keep-directory-symlink -C / + if [ $? -ne 0 ]; then + echo "Error processing $newest_file" >&2 + exit 1 + fi fi else tar -I zstd -xf "$newest_file" --keep-directory-symlink -C / + if [ $? -ne 0 ]; then + echo "Error processing $newest_file" >&2 + exit 1 + fi fi echo "Backup '$newest_file' restored" done <<< "$keys"