summaryrefslogtreecommitdiff
path: root/images/backup/duplicity/restore.sh
blob: df3f9c93372b4bcc9f4f0c4f8863abad86765699 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh -xe
set -x
set -e

CONNECTION_OPTIONS="--use-agent \
          --verbosity $LOG_LEVEL \
          --num-retries 3 \
          --encrypt-key $FINGERPRINT \
          --log-file /dev/stdout \
          --archive-dir /cache/archive \
          --ssh-options=-oIdentityFile=/ssh_keys/backup \
          --gpg-options --passphrase=$PASSPHRASE \
          --gpg-options --no-tty \
          --gpg-options --batch \
          --gpg-options --pinentry-mode=loopback"

# Import and trust the GPG Keys
gpg --passphrase $PASSPHRASE --no-tty --batch --import /gpg_keys/*.priv.asc
echo "$FINGERPRINT:6:" | gpg --import-ownertrust

mkdir -p /cache/archive

# Restore the Backup
duplicity restore \
    $CONNECTION_OPTIONS \
    "$BACKUP_STORAGE" /data/