From b02d248b0c51e6d8c36c8fe46ae961fba0b8b62d Mon Sep 17 00:00:00 2001 From: redxef Date: Thu, 8 Jun 2023 00:17:37 +0200 Subject: [PATCH] Rename alternative tar command variable. --- tarback.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tarback.sh b/tarback.sh index 57a9772..da691c9 100755 --- a/tarback.sh +++ b/tarback.sh @@ -11,12 +11,12 @@ TARBACK_TRANSFORM_REMOTE_ARGUMENT_COMMAND_DEFAULT= # shellcheck disable=SC2016 # disable variable not expanding hint TARBACK_TAR_CREATE_COMMAND_DEFAULT='tar c -C "$1" .' # 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" ]' # shellcheck disable=SC2016 # disable variable not expanding hint TARBACK_TAR_EXTRACT_COMMAND_DEFAULT='tar x -C "$1"' # 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_COMPRESSION_DEFAULT='xz' 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_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_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_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_COMPRESSION="${TARBACK_COMPRESSION:-$TARBACK_COMPRESSION_DEFAULT}" TARBACK_SPLIT="${TARBACK_SPLIT:-$TARBACK_SPLIT_DEFAULT}" @@ -75,7 +75,7 @@ _create() { if ! sh -c "$TARBACK_TAR_CREATE_USE_ALT_COMMAND" - "$src"; then tarback_tar_create_command="$TARBACK_TAR_CREATE_COMMAND" else - tarback_tar_create_command="$TARBACK_TAR_CREATE_COMMAND_FILE" + tarback_tar_create_command="$TARBACK_TAR_CREATE_ALT_COMMAND" fi tarback_tar_create_command="$(_transform_remote "$tarback_tar_create_command")" $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 tarback_tar_extract_command="$TARBACK_TAR_EXTRACT_COMMAND" else - tarback_tar_extract_command="$TARBACK_TAR_EXTRACT_COMMAND_FILE" + tarback_tar_extract_command="$TARBACK_TAR_EXTRACT_ALT_COMMAND" fi tarback_tar_extract_command="$(_transform_remote "$tarback_tar_extract_command")" $TARBACK_MERGE "$src"* \