2
0
Fork 0
main
Ducky 2023-08-25 01:26:15 +01:00
parent b057929c56
commit 5d67f27a7e
2 changed files with 11 additions and 2 deletions

View File

@ -114,6 +114,8 @@ function invoke_script() {
export -f backup_dir
export -f backup_dumps
export -f backup_files
export -f create_tmp_file
export -f die
export -f forget_backup
export -f get_config_dir
@ -144,7 +146,7 @@ function invoke_script() {
function backup_files() {
patterns="$1"
args="${@:2}"
files_from_path="/tmp/files-from" # TODO: Helper function for this
files_from_path="$(create_tmp_file "files-from")"
echo "$patterns" > "$files_from_path"
sed -i -e 's/:/\n/g' "$files_from_path"
@ -187,7 +189,7 @@ function backup_dir() {
if [[ ! -d "$path" ]]; then
say warning "'$path' does not exist. Not backing up"
else
files "$path" $args
backup_files "$path" $args
fi
}

View File

@ -4,6 +4,13 @@ function container_exec() {
podman_exec $@
}
function create_tmp_file() {
name="$1"
tmp_path="/tmp/$@_$(date +%s)_$name"
touch "$tmp_path"
echo "$tmp_path"
}
function die() {
say error "$@"
exit 255