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