449c26d59637ab138e01520275e6320a11a92e0a

Author
Zertrin <zertrin@gmail.com>
Committer
Zertrin <zertrin@gmail.com>
Date

Message

Fix issue #16

Diff

 1diff --git a/duplicity-backup.sh b/duplicity-backup.sh
 2index a7206c569a9e451f9d8f9462d9dc1369e6a78b9f..92fe493525fd9cd9e41d1a197224085766324c6f 100755
 3--- a/duplicity-backup.sh
 4+++ b/duplicity-backup.sh
 5@@ -359,6 +359,18 @@ duplicity_backup()
 6   >> ${LOGFILE}
 7 }
 8 
 9+setup_passphrases_for_restore()
10+{
11+  if [ ! -z "$GPG_ENC_KEY" -a ! -z "$GPG_SIGN_KEY" -a "$GPG_ENC_KEY" != "$GPG_SIGN_KEY" ]; then
12+    SIGN_PASSPHRASE=$PASSPHRASE
13+    echo "Please provide the passphrase for decryption (GPG key 0x${GPG_ENC_KEY}):"
14+    read -e ENCPASSPHRASE
15+    PASSPHRASE=$ENCPASSPHRASE
16+    export SIGN_PASSPHRASE
17+    export PASSPHRASE
18+  fi
19+}
20+
21 get_file_sizes()
22 {
23   get_source_file_size
24@@ -495,6 +507,7 @@ case "$COMMAND" in
25       DEST=$RESTORE_DEST
26     fi
27 
28+    setup_passphrases_for_restore
29     echo "Attempting to restore now ..."
30     duplicity_backup
31   ;;
32@@ -532,6 +545,7 @@ case "$COMMAND" in
33     FILE_TO_RESTORE="'"$FILE_TO_RESTORE"'"
34     DEST="'"$DEST"'"
35 
36+    setup_passphrases_for_restore
37     echo "Restoring now ..."
38     #use INCLUDE variable without create another one
39     INCLUDE="--file-to-restore ${FILE_TO_RESTORE}"
40@@ -578,5 +592,6 @@ fi
41 unset AWS_ACCESS_KEY_ID
42 unset AWS_SECRET_ACCESS_KEY
43 unset PASSPHRASE
44+unset SIGN_PASSPHRASE
45 
46 # vim: set tabstop=2 shiftwidth=2 sts=2 autoindent smartindent: