Ignore inexistent backup archives

This commit is contained in:
Manuel Thalmann 2024-12-04 17:02:01 +01:00
parent a46ea0cacc
commit 3607765313

View file

@ -23,9 +23,10 @@ end
function restoreFiles
if [ -n "$VALHALLA_BACKUP_DIR" ]
argparse -i "user=" "base-directory=" -- $argv
set -l path (getArchivePath $argv)
set -l tarArgs
set -l sudoArgs
argparse -i "user=" "base-directory=" -- $argv
if [ -n "$_flag_base_directory" ]
set -a tarArgs -C "$_flag_base_directory"
@ -37,8 +38,8 @@ function restoreFiles
set -a sudoArgs -u "$_flag_user"
end
fetchArchive $argv | begin
sudo $sudoArgs tar $tarArgs -xvz
if runRestorationCommand test -f "$path"
runRestorationCommand cat "$path" | sudo $sudoArgs tar $tarArgs -xvz
end
end
end
@ -47,11 +48,6 @@ function createArchive -a path
runRestorationCommand sh -c "tee $(string escape -- "$path") >/dev/null"
end
function fetchArchive
set -l path (getArchivePath $argv)
runRestorationCommand cat "$path"
end
function runRestorationCommand
if [ -z "$VALHALLA_BACKUP_SERVER" ]
$argv