2
0
Fork 0
main
Ducky 2023-08-25 01:21:32 +01:00
parent d1c2189f1a
commit b057929c56
1 changed files with 40 additions and 26 deletions

View File

@ -141,17 +141,19 @@ function invoke_script() {
"$backup_scripts_dir/$backup_script_filename" "$backup_scripts_dir/$backup_script_filename"
} }
function backup_dir() { function backup_files() {
path="$1" patterns="$1"
args="${@:2}" args="${@:2}"
files_from_path="/tmp/files-from" # TODO: Helper function for this
if [[ ! -d "$path" ]]; then echo "$patterns" > "$files_from_path"
say warning "'$path' does not exist. Not backing up" sed -i -e 's/:/\n/g' "$files_from_path"
else
say info "Backing up: $path ➔ $(cat $restic_repo_file)" say info "Backing up: $patterns ➔ $(cat $restic_repo_file)"
invoke_restic \ invoke_restic \
backup \ backup \
--files-from "$files_from_path" \
--iexclude "__MACOSX" \ --iexclude "__MACOSX" \
--iexclude ".cache" \ --iexclude ".cache" \
--iexclude ".DS_Store" \ --iexclude ".DS_Store" \
@ -173,7 +175,19 @@ function backup_dir() {
--host "$host" \ --host "$host" \
--tag "$me_filename" \ --tag "$me_filename" \
--tag "$(basename "$0")" \ --tag "$(basename "$0")" \
$args "$path" $args "/"
rm -f "$files_from_path"
}
function backup_dir() {
path="$1"
args="${@:2}"
if [[ ! -d "$path" ]]; then
say warning "'$path' does not exist. Not backing up"
else
files "$path" $args
fi fi
} }