Additionally to backing up a docker volume, allow to run in docker.

This commit is contained in:
redxef 2023-06-08 17:49:44 +02:00
parent 9aa896f501
commit 49168edafb
Signed by: redxef
GPG key ID: 7DAC3AA211CBD921

View file

@ -1,7 +1,25 @@
#!/bin/sh #!/bin/sh
_tarback_plugin_docker_cmd='docker run -i --rm --workdir=/mnt --volume="$1":/mnt/"$1" alpine ' _tarback_plugin_docker_use_container=false
TARBACK_TAR_CREATE_COMMAND="$_tarback_plugin_docker_cmd "'tar c -C "/mnt/$1" .'
TARBACK_TAR_EXTRACT_COMMAND="$_tarback_plugin_docker_cmd "'tar x -C "/mnt/$1"' short_options='c'
while getopts "$short_options" arg; do
case "$arg" in
c)
_tarback_plugin_docker_use_container="$OPTARG"
;;
esac
done
if "$_tarback_plugin_docker_use_container"; then
_tarback_plugin_docker_cmd='docker exec -i "$1" '
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
TARBACK_TAR_CREATE_USE_ALT_COMMAND=false TARBACK_TAR_CREATE_USE_ALT_COMMAND=false
TARBACK_TAR_EXTRACT_USE_ALT_COMMAND=false TARBACK_TAR_EXTRACT_USE_ALT_COMMAND=false