Fix container case (probably).

This commit is contained in:
redxef 2023-06-08 17:58:53 +02:00
parent 49168edafb
commit 47781e8bcf
Signed by: redxef
GPG key ID: 7DAC3AA211CBD921

View file

@ -1,8 +1,8 @@
#!/bin/sh #!/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 while getopts "$short_options" arg; do
case "$arg" in case "$arg" in
c) c)
@ -11,13 +11,12 @@ while getopts "$short_options" arg; do
esac esac
done done
if "$_tarback_plugin_docker_use_container"; then if [ -n "$_tarback_plugin_docker_use_container" ]; then
_tarback_plugin_docker_cmd='docker exec -i "$1" ' _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_CREATE_COMMAND="$_tarback_plugin_docker_cmd $TARBACK_TAR_CREATE_COMMAND"
TARBACK_TAR_EXTRACT_COMMAND="$_tarback_plugin_docker_cmd $TARBACK_TAR_EXTRACT_COMMAND" TARBACK_TAR_EXTRACT_COMMAND="$_tarback_plugin_docker_cmd $TARBACK_TAR_EXTRACT_COMMAND"
else else
_tarback_plugin_docker_cmd='docker run -i --rm --workdir=/mnt --volume="$1":/mnt/"$1" alpine ' _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_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')" TARBACK_TAR_EXTRACT_COMMAND="$_tarback_plugin_docker_cmd $(echo "$TARBACK_TAR_EXTRACT_COMMAND" | sed 's_$1_/mnt/$1_g')"
fi fi