local number="$2"
local machine="$3"
local path="$4"
- local key="$5"
+ local origin="$5"
+ local key="$6"
+ local deletemode=
local backup_root=$(cat config.yaml \
| yq --raw-output '.backup_path')
local backup_name=$(cat config.yaml \
local restore_path="$restore_prefix_path$path"
local remote_path="$remote_user@$remote_machine:$path"
+ [ "$origin" == "deletemode-on" ] \
+ && deletemode="--delete" \
+ && echo "ℹ️ INFO: delete mode on"
+
local mode="directory"
[[ "$path" =~ /$ ]] || mode="file"
--acls \
--hard-links \
--human-readable \
+ $deletemode \
--rsh "ssh -p $remote_port" \
$restore_path \
$remote_path \
local machine=
local path=
local key=
+ local origin="deletemode-off"
echo "⭐ START: restore"
- while getopts "d:k:n:r:p:h" optname; do
+ while getopts "d:k:n:r:p:ho" optname; do
case "$optname" in
"d") date="$OPTARG" ;;
"k") key="$OPTARG" ;;
"n") number="$OPTARG" ;;
"r") machine="$OPTARG" ;;
"p") path="$OPTARG" ;;
+ "o") origin="deletemode-on" ;;
"h") useage && return 0 ;;
esac
done
|| return $?
[ -n "$path" ] || errlog "missing path (-p)" || return $?
- restore "$date" "$number" "$machine" "$path" "$key" \
+ restore "$date" "$number" "$machine" "$path" "$origin" "$key" \
|| return $?
echo "✅ SUCCESS: restore"