From 47781e8bcf41746d2a84f3716e47b146ac9ebf13 Mon Sep 17 00:00:00 2001 From: redxef Date: Thu, 8 Jun 2023 17:58:53 +0200 Subject: [PATCH] Fix container case (probably). --- tarback/docker.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tarback/docker.sh b/tarback/docker.sh index eb8d02a..f8a748b 100644 --- a/tarback/docker.sh +++ b/tarback/docker.sh @@ -1,8 +1,8 @@ #!/bin/sh -_tarback_plugin_docker_use_container=false +_tarback_plugin_docker_use_container= -short_options='c' +short_options='c:' while getopts "$short_options" arg; do case "$arg" in c) @@ -11,13 +11,12 @@ while getopts "$short_options" arg; do esac done -if "$_tarback_plugin_docker_use_container"; then - _tarback_plugin_docker_cmd='docker exec -i "$1" ' +if [ -n "$_tarback_plugin_docker_use_container" ]; then + _tarback_plugin_docker_cmd="docker exec -i '$_tarback_plugin_docker_use_container' " TARBACK_TAR_CREATE_COMMAND="$_tarback_plugin_docker_cmd $TARBACK_TAR_CREATE_COMMAND" TARBACK_TAR_EXTRACT_COMMAND="$_tarback_plugin_docker_cmd $TARBACK_TAR_EXTRACT_COMMAND" else _tarback_plugin_docker_cmd='docker run -i --rm --workdir=/mnt --volume="$1":/mnt/"$1" alpine ' - TARBACK_TAR_CREATE_COMMAND="$_tarback_plugin_docker_cmd $(echo "$TARBACK_TAR_CREATE_COMMAND" | sed 's_$1_/mnt/$1_g')" TARBACK_TAR_EXTRACT_COMMAND="$_tarback_plugin_docker_cmd $(echo "$TARBACK_TAR_EXTRACT_COMMAND" | sed 's_$1_/mnt/$1_g')" fi