comparison docker/libervia_cont.sh @ 100:d9f9de4bd7a0

docker (libervia_cont): fixed restore when full backup path is used
author Goffi <goffi@goffi.org>
date Fri, 26 Feb 2016 20:20:36 +0100
parents 15e317bb602f
children 83dacf8fda47
comparison
equal deleted inserted replaced
99:15e317bb602f 100:d9f9de4bd7a0
333 Hint: you can also rename your current data container with \"docker rename $VOLUME_ALIAS new_container_name\"\n" 333 Hint: you can also rename your current data container with \"docker rename $VOLUME_ALIAS new_container_name\"\n"
334 exit 1 334 exit 1
335 fi 335 fi
336 336
337 printf "restoring $1 to $VOLUME_ALIAS container\n\n" 337 printf "restoring $1 to $VOLUME_ALIAS container\n\n"
338 HOST_BACKUP_DIR="$(dirname "$1")" 338 HOST_BACKUP_DIR=$(dirname "$1")
339 HOST_BACKUP_NAME=$(basename "$1")
339 if [ $HOST_BACKUP_DIR = "." ]; then 340 if [ $HOST_BACKUP_DIR = "." ]; then
340 # workaround for a Docker bug (container crash if "." is used) 341 # workaround for a Docker bug (container crash if "." is used)
341 HOST_BACKUP_DIR=$(pwd) 342 HOST_BACKUP_DIR=$(pwd)
342 fi 343 fi
343 docker run --rm $DK_VOLUME -v "$HOST_BACKUP_DIR:/backup" debian:jessie tar zxvf "/backup/$1" -C / -h volumes 344 docker run --rm $DK_VOLUME -v "$HOST_BACKUP_DIR:/backup" debian:jessie tar zxvf "/backup/$HOST_BACKUP_NAME" -C / -h volumes
344 if [ $? -eq 0 ]; then 345 if [ $? -eq 0 ]; then
345 printf "\nRestore finished\n" 346 printf "\nRestore finished\n"
346 else 347 else
347 printf "\nRestore Error !\n" 348 printf "\nRestore Error !\n"
348 exit 1 349 exit 1