various
parent
b057929c56
commit
5d67f27a7e
|
@ -114,6 +114,8 @@ function invoke_script() {
|
||||||
|
|
||||||
export -f backup_dir
|
export -f backup_dir
|
||||||
export -f backup_dumps
|
export -f backup_dumps
|
||||||
|
export -f backup_files
|
||||||
|
export -f create_tmp_file
|
||||||
export -f die
|
export -f die
|
||||||
export -f forget_backup
|
export -f forget_backup
|
||||||
export -f get_config_dir
|
export -f get_config_dir
|
||||||
|
@ -144,7 +146,7 @@ function invoke_script() {
|
||||||
function backup_files() {
|
function backup_files() {
|
||||||
patterns="$1"
|
patterns="$1"
|
||||||
args="${@:2}"
|
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"
|
echo "$patterns" > "$files_from_path"
|
||||||
sed -i -e 's/:/\n/g' "$files_from_path"
|
sed -i -e 's/:/\n/g' "$files_from_path"
|
||||||
|
@ -187,7 +189,7 @@ function backup_dir() {
|
||||||
if [[ ! -d "$path" ]]; then
|
if [[ ! -d "$path" ]]; then
|
||||||
say warning "'$path' does not exist. Not backing up"
|
say warning "'$path' does not exist. Not backing up"
|
||||||
else
|
else
|
||||||
files "$path" $args
|
backup_files "$path" $args
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,13 @@ function container_exec() {
|
||||||
podman_exec $@
|
podman_exec $@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function create_tmp_file() {
|
||||||
|
name="$1"
|
||||||
|
tmp_path="/tmp/$@_$(date +%s)_$name"
|
||||||
|
touch "$tmp_path"
|
||||||
|
echo "$tmp_path"
|
||||||
|
}
|
||||||
|
|
||||||
function die() {
|
function die() {
|
||||||
say error "$@"
|
say error "$@"
|
||||||
exit 255
|
exit 255
|
||||||
|
|
Loading…
Reference in New Issue