#!/bin/bash set -eu usage () { echo echo Usage: ./import-backup.sh [-h, --help] backup-tar echo echo This utility imports a TAR backup of data and logs echo into the Taler services running inside this Docker echo Compose setup. } for arg in "$@"; do if test "$arg" = "--help" -o "$arg" = "-h"; then usage exit 0 fi done if ! which docker > /dev/null; then echo docker not found. exit 1 fi if ! docker images | grep debian | grep stable > /dev/null; then echo debian:stable not found. Please extract backup with custom image. exit 2 fi # No --help/-h given, assume the first argument is the TAR. BACKUP_TAR="${1:-}" if test -z $BACKUP_TAR; then echo Backup file argument not given. exit 1 fi if ! test -a $BACKUP_TAR; then echo File $BACKUP_TAR not found. exit 1 fi docker run \ -v $BACKUP_TAR:/tmp/backup.tar \ -v demo_talerdata:/taler-data \ -v demo_talerlogs:/taler-logs \ -it debian:stable /bin/bash -c "tar -x -f /tmp/backup.tar"