Additionally to backing up a docker volume, allow to run in docker.
This commit is contained in:
parent
9aa896f501
commit
49168edafb
1 changed files with 21 additions and 3 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue