Rename alternative tar command variable.

This commit is contained in:
redxef 2023-06-08 00:17:37 +02:00
parent dfb3696910
commit b02d248b0c
Signed by: redxef
GPG key ID: 7DAC3AA211CBD921

View file

@ -11,12 +11,12 @@ TARBACK_TRANSFORM_REMOTE_ARGUMENT_COMMAND_DEFAULT=
# shellcheck disable=SC2016 # disable variable not expanding hint # shellcheck disable=SC2016 # disable variable not expanding hint
TARBACK_TAR_CREATE_COMMAND_DEFAULT='tar c -C "$1" .' TARBACK_TAR_CREATE_COMMAND_DEFAULT='tar c -C "$1" .'
# shellcheck disable=SC2016 # disable variable not expanding hint # shellcheck disable=SC2016 # disable variable not expanding hint
TARBACK_TAR_CREATE_COMMAND_FILE_DEFAULT='tar c -C "$(dirname "$1")" "$(basename "$1")"' TARBACK_TAR_CREATE_ALT_COMMAND_DEFAULT='tar c -C "$(dirname "$1")" "$(basename "$1")"'
TARBACK_TAR_CREATE_USE_ALT_COMMAND_DEFAULT='[ ! -d "$1" ]' TARBACK_TAR_CREATE_USE_ALT_COMMAND_DEFAULT='[ ! -d "$1" ]'
# shellcheck disable=SC2016 # disable variable not expanding hint # shellcheck disable=SC2016 # disable variable not expanding hint
TARBACK_TAR_EXTRACT_COMMAND_DEFAULT='tar x -C "$1"' TARBACK_TAR_EXTRACT_COMMAND_DEFAULT='tar x -C "$1"'
# shellcheck disable=SC2016 # disable variable not expanding hint # shellcheck disable=SC2016 # disable variable not expanding hint
TARBACK_TAR_EXTRACT_COMMAND_FILE_DEFAULT='tar x -C "$(dirname "$1")"' TARBACK_TAR_EXTRACT_ALT_COMMAND_DEFAULT='tar x -C "$(dirname "$1")"'
TARBACK_TAR_EXTRACT_USE_ALT_COMMAND_DEFAULT='[ ! -e "$1" ] && [ -d "$(dirname "$1")" ]' TARBACK_TAR_EXTRACT_USE_ALT_COMMAND_DEFAULT='[ ! -e "$1" ] && [ -d "$(dirname "$1")" ]'
TARBACK_COMPRESSION_DEFAULT='xz' TARBACK_COMPRESSION_DEFAULT='xz'
TARBACK_SPLIT_DEFAULT="split -b $((128*1024*1024)) -" TARBACK_SPLIT_DEFAULT="split -b $((128*1024*1024)) -"
@ -31,10 +31,10 @@ TARBACK_REMOTE="${TARBACK_REMOTE:-$TARBACK_REMOTE_DEFAULT}"
TARBACK_TRANSFORM_REMOTE_COMMAND="${TARBACK_TRANSFORM_REMOTE_COMMAND:-$TARBACK_TRANSFORM_REMOTE_COMMAND_DEFAULT}" TARBACK_TRANSFORM_REMOTE_COMMAND="${TARBACK_TRANSFORM_REMOTE_COMMAND:-$TARBACK_TRANSFORM_REMOTE_COMMAND_DEFAULT}"
TARBACK_TRANSFORM_REMOTE_ARGUMENT_COMMAND="${TARBACK_TRANSFORM_REMOTE_ARGUMENT_COMMAND:-$TARBACK_TRANSFORM_REMOTE_ARGUMENT_COMMAND_DEFAULT}" TARBACK_TRANSFORM_REMOTE_ARGUMENT_COMMAND="${TARBACK_TRANSFORM_REMOTE_ARGUMENT_COMMAND:-$TARBACK_TRANSFORM_REMOTE_ARGUMENT_COMMAND_DEFAULT}"
TARBACK_TAR_CREATE_COMMAND="${TARBACK_TAR_CREATE_COMMAND:-$TARBACK_TAR_CREATE_COMMAND_DEFAULT}" TARBACK_TAR_CREATE_COMMAND="${TARBACK_TAR_CREATE_COMMAND:-$TARBACK_TAR_CREATE_COMMAND_DEFAULT}"
TARBACK_TAR_CREATE_COMMAND_FILE="${TARBACK_TAR_CREATE_COMMAND_FILE:-$TARBACK_TAR_CREATE_COMMAND_FILE_DEFAULT}" TARBACK_TAR_CREATE_ALT_COMMAND="${TARBACK_TAR_CREATE_ALT_COMMAND:-$TARBACK_TAR_CREATE_ALT_COMMAND_DEFAULT}"
TARBACK_TAR_CREATE_USE_ALT_COMMAND="${TARBACK_TAR_CREATE_USE_ALT_COMMAND:-$TARBACK_TAR_CREATE_USE_ALT_COMMAND_DEFAULT}" TARBACK_TAR_CREATE_USE_ALT_COMMAND="${TARBACK_TAR_CREATE_USE_ALT_COMMAND:-$TARBACK_TAR_CREATE_USE_ALT_COMMAND_DEFAULT}"
TARBACK_TAR_EXTRACT_COMMAND="${TARBACK_TAR_EXTRACT_COMMAND:-$TARBACK_TAR_EXTRACT_COMMAND_DEFAULT}" TARBACK_TAR_EXTRACT_COMMAND="${TARBACK_TAR_EXTRACT_COMMAND:-$TARBACK_TAR_EXTRACT_COMMAND_DEFAULT}"
TARBACK_TAR_EXTRACT_COMMAND_FILE="${TARBACK_TAR_EXTRACT_COMMAND_FILE:-$TARBACK_TAR_EXTRACT_COMMAND_FILE_DEFAULT}" TARBACK_TAR_EXTRACT_ALT_COMMAND="${TARBACK_TAR_EXTRACT_ALT_COMMAND:-$TARBACK_TAR_EXTRACT_ALT_COMMAND_DEFAULT}"
TARBACK_TAR_EXTRACT_USE_ALT_COMMAND="${TARBACK_TAR_EXTRACT_USE_ALT_COMMAND:-$TARBACK_TAR_EXTRACT_USE_ALT_COMMAND_DEFAULT}" TARBACK_TAR_EXTRACT_USE_ALT_COMMAND="${TARBACK_TAR_EXTRACT_USE_ALT_COMMAND:-$TARBACK_TAR_EXTRACT_USE_ALT_COMMAND_DEFAULT}"
TARBACK_COMPRESSION="${TARBACK_COMPRESSION:-$TARBACK_COMPRESSION_DEFAULT}" TARBACK_COMPRESSION="${TARBACK_COMPRESSION:-$TARBACK_COMPRESSION_DEFAULT}"
TARBACK_SPLIT="${TARBACK_SPLIT:-$TARBACK_SPLIT_DEFAULT}" TARBACK_SPLIT="${TARBACK_SPLIT:-$TARBACK_SPLIT_DEFAULT}"
@ -75,7 +75,7 @@ _create() {
if ! sh -c "$TARBACK_TAR_CREATE_USE_ALT_COMMAND" - "$src"; then if ! sh -c "$TARBACK_TAR_CREATE_USE_ALT_COMMAND" - "$src"; then
tarback_tar_create_command="$TARBACK_TAR_CREATE_COMMAND" tarback_tar_create_command="$TARBACK_TAR_CREATE_COMMAND"
else else
tarback_tar_create_command="$TARBACK_TAR_CREATE_COMMAND_FILE" tarback_tar_create_command="$TARBACK_TAR_CREATE_ALT_COMMAND"
fi fi
tarback_tar_create_command="$(_transform_remote "$tarback_tar_create_command")" tarback_tar_create_command="$(_transform_remote "$tarback_tar_create_command")"
$TARBACK_REMOTE sh -c "$tarback_tar_create_command" - "$(_transform_argument "$src")" \ $TARBACK_REMOTE sh -c "$tarback_tar_create_command" - "$(_transform_argument "$src")" \
@ -93,7 +93,7 @@ _restore() {
if ! sh -c "$TARBACK_TAR_EXTRACT_USE_ALT_COMMAND" - "$dst"; then if ! sh -c "$TARBACK_TAR_EXTRACT_USE_ALT_COMMAND" - "$dst"; then
tarback_tar_extract_command="$TARBACK_TAR_EXTRACT_COMMAND" tarback_tar_extract_command="$TARBACK_TAR_EXTRACT_COMMAND"
else else
tarback_tar_extract_command="$TARBACK_TAR_EXTRACT_COMMAND_FILE" tarback_tar_extract_command="$TARBACK_TAR_EXTRACT_ALT_COMMAND"
fi fi
tarback_tar_extract_command="$(_transform_remote "$tarback_tar_extract_command")" tarback_tar_extract_command="$(_transform_remote "$tarback_tar_extract_command")"
$TARBACK_MERGE "$src"* \ $TARBACK_MERGE "$src"* \