dsnap-sync: args parser

- prepare arguments as string for ssh call
This commit is contained in:
2018-06-25 19:59:43 +02:00
parent b607ae3eba
commit d86282b27b

View File

@@ -50,6 +50,7 @@ BTRFS_PIPE=$TMPDIR_PIPE/btrfs.out
exec 3>$PIPE 4>$BTRFS_PIPE
# global variables
args=
donotify=0
answer=no
disk_count=-1
@@ -128,6 +129,23 @@ check_snapper_failed_ids () {
fi
}
quote_args () {
# quote command in ssh call to prevent remote side from expanding any arguments
# using dash's buildin printf
args=
if [ $# -gt 0 ]; then
# no need to make COMMAND an array - ssh will merge it anyway
COMMAND=
while [ $# -gt 0 ]; do
arg=$(printf "%s" "$1")
COMMAND="${COMMAND}${arg} "
shift
done
args="${args}${COMMAND}"
fi
}
set_snapper_target_config () {
local snapper_config=$1
local snapper_config_tpye='none'