413e053c62756d97d600e920cb47416b4cf95eb3

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

Message

Follow-up fix Issue #16

Diff

 1diff --git a/duplicity-backup.sh b/duplicity-backup.sh
 2index 92fe493525fd9cd9e41d1a197224085766324c6f..6fde6aa08ddd6fff4a3fb090b5c5ec45b01e89af 100755
 3--- a/duplicity-backup.sh
 4+++ b/duplicity-backup.sh
 5@@ -145,9 +145,11 @@ else
 6   exit 1
 7 fi
 8 
 9+SIGN_PASSPHRASE=$PASSPHRASE
10 export AWS_ACCESS_KEY_ID
11 export AWS_SECRET_ACCESS_KEY
12 export PASSPHRASE
13+export SIGN_PASSPHRASE
14 
15 LOGFILE="${LOGDIR}${LOG_FILE}"
16 DUPLICITY="$(which duplicity)"
17@@ -359,14 +361,13 @@ duplicity_backup()
18   >> ${LOGFILE}
19 }
20 
21-setup_passphrases_for_restore()
22+setup_passphrase()
23 {
24   if [ ! -z "$GPG_ENC_KEY" -a ! -z "$GPG_SIGN_KEY" -a "$GPG_ENC_KEY" != "$GPG_SIGN_KEY" ]; then
25-    SIGN_PASSPHRASE=$PASSPHRASE
26-    echo "Please provide the passphrase for decryption (GPG key 0x${GPG_ENC_KEY}):"
27-    read -e ENCPASSPHRASE
28+    echo -n "Please provide the passphrase for decryption (GPG key 0x${GPG_ENC_KEY}): "
29+    builtin read -s ENCPASSPHRASE
30+    echo -ne "\n"
31     PASSPHRASE=$ENCPASSPHRASE
32-    export SIGN_PASSPHRASE
33     export PASSPHRASE
34   fi
35 }
36@@ -476,6 +477,8 @@ case "$COMMAND" in
37 
38     echo -e "-------[ Verifying Source & Destination ]-------\n" >> ${LOGFILE}
39     include_exclude
40+    setup_passphrase
41+    echo -e "Attempting to verify now ..."
42     duplicity_backup
43 
44     OLDROOT=${ROOT}
45@@ -507,7 +510,7 @@ case "$COMMAND" in
46       DEST=$RESTORE_DEST
47     fi
48 
49-    setup_passphrases_for_restore
50+    setup_passphrase
51     echo "Attempting to restore now ..."
52     duplicity_backup
53   ;;
54@@ -545,7 +548,7 @@ case "$COMMAND" in
55     FILE_TO_RESTORE="'"$FILE_TO_RESTORE"'"
56     DEST="'"$DEST"'"
57 
58-    setup_passphrases_for_restore
59+    setup_passphrase
60     echo "Restoring now ..."
61     #use INCLUDE variable without create another one
62     INCLUDE="--file-to-restore ${FILE_TO_RESTORE}"