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,6 +141,45 @@ function invoke_script() {
"$backup_scripts_dir/$backup_script_filename"
}
function backup_files() {
patterns="$1"
args="${@:2}"
files_from_path="/tmp/files-from" # TODO: Helper function for this
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" \
--iexclude "cache" \
--iexclude "CachedData" \
--iexclude "CachedExtensionVSIXs" \
--iexclude "Code Cache" \
--iexclude "GPUCache" \
--iexclude "GrSharedCache" \
--iexclude "ShaderCache" \
--iexclude "system-cache" \
--iexclude "thumbs.db" \
--iexclude "tmp" \
--exclude "containers/storage/overlay" \
--exclude "containers/storage/overlay-containers" \
--exclude "containers/storage/overlay-images" \
--exclude "containers/storage/overlay-layers" \
--exclude-if-present ".nobackup" \
--host "$host" \
--tag "$me_filename" \
--tag "$(basename "$0")" \
$args "/"
rm -f "$files_from_path"
}
function backup_dir() {
path="$1"
args="${@:2}"
@ -148,32 +187,7 @@ function backup_dir() {
if [[ ! -d "$path" ]]; then
say warning "'$path' does not exist. Not backing up"
else
say info "Backing up: $path ➔ $(cat $restic_repo_file)"
invoke_restic \
backup \
--iexclude "__MACOSX" \
--iexclude ".cache" \
--iexclude ".DS_Store" \
--iexclude "cache" \
--iexclude "CachedData" \
--iexclude "CachedExtensionVSIXs" \
--iexclude "Code Cache" \
--iexclude "GPUCache" \
--iexclude "GrSharedCache" \
--iexclude "ShaderCache" \
--iexclude "system-cache" \
--iexclude "thumbs.db" \
--iexclude "tmp" \
--exclude "containers/storage/overlay" \
--exclude "containers/storage/overlay-containers" \
--exclude "containers/storage/overlay-images" \
--exclude "containers/storage/overlay-layers" \
--exclude-if-present ".nobackup" \
--host "$host" \
--tag "$me_filename" \
--tag "$(basename "$0")" \
$args "$path"
files "$path" $args
fi
}