Skip to content

Commit

Permalink
fix gpg decryption bug
Browse files Browse the repository at this point in the history
gpg decryption from a pipe can't happen unless the key has already been
cached.  Resort to file based decryption with output to stdout.
  • Loading branch information
TrentonAdams committed Jun 4, 2021
1 parent a75a73d commit 2bcefbf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 2.3.2
- fix gpg decryption bug

### 2.3.1
- README update for 2.3.0

Expand Down
9 changes: 8 additions & 1 deletion components/restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ function doRestore() {

for backup in ${source_folder}/${backup_name}.*.backup*; do
echo "restoring ${backup}"
cat "${backup}" | decrypt | tar -C "${destination_folder}" -g /dev/null -xvz
gpg --pinentry-mode cancel --list-packets "${backup}" > /dev/null
if [ $? -eq 0 ]; then
gpg -d -o - "${backup}" | tar -C "${destination_folder}" -g /dev/null -xvz
else
tar -C "${destination_folder}" -g /dev/null -xvzf "${backup}"
fi


done
}
3 changes: 2 additions & 1 deletion test/cloud-tar.bats
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ source ./cloud-tar.sh
assert [ -f backup/test-backup.0.backupaa ]
refute_output --partial "WARNING your backup will not be encrypted, as no gpg recipient was specified"

function listBackup() { cat backup/test-backup.0.backupaa| gpg -d -o - | tar -tvz; }
function listBackup() { gpg -d -o - backup/test-backup.0.backupaa | tar -tvz; }

run listBackup
for i in {1..10}; do
assert_output --partial "files/file-${i}";
Expand Down

0 comments on commit 2bcefbf

Please sign in to comment.