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