From 8924ae31fff2bfbcfbb486692dd34c085ae64862 Mon Sep 17 00:00:00 2001 From: deajan Date: Sun, 4 Sep 2016 22:34:42 +0200 Subject: [PATCH] Still trying to resolve the mystery of GPG in travis --- dev/n_obackup.sh | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/dev/n_obackup.sh b/dev/n_obackup.sh index ea5a073..e7268c6 100755 --- a/dev/n_obackup.sh +++ b/dev/n_obackup.sh @@ -1028,6 +1028,7 @@ function DecryptFiles { __CheckArguments 3 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG + local options local secret local successCounter=0 local errorCounter=0 @@ -1039,12 +1040,12 @@ function DecryptFiles { fi #TODO: ugly fix : gpg 1.4.x fails with passphrase-file but not with passphrase (error is: can't query passphrase in batch mode) - if [ "$CRYPT_TOOL" == "gpg2" ] && [ -f "$passphraseFile" ]; then - secret="--passphrase-file $passphraseFile" - elif [ "$CRYPT_TOOL" == "gpg" ] && [ -f "$passphraseFile" ]; then - secret="$$passphrase $(cat "$passphraseFile")" - #if [ -f "$passphraseFile" ]; then + #if [ "$CRYPT_TOOL" == "gpg2" ] && [ -f "$passphraseFile" ]; then # secret="--passphrase-file $passphraseFile" + #elif [ "$CRYPT_TOOL" == "gpg" ] && [ -f "$passphraseFile" ]; then + # secret="$$passphrase $(cat "$passphraseFile")" + if [ -f "$passphraseFile" ]; then + secret="--passphrase-file $passphraseFile" elif [ "$passphrase" != "" ]; then secret="--passphrase $passphrase" else @@ -1052,11 +1053,17 @@ function DecryptFiles { exit 1 fi + if [ "$CRYPT_TOOL" == "gpg2" ]; then + options="--batch --yes" + elif [ "$CRYPT_TOOL" == "gpg" ]; then + options="--no-use-agent --batch" + fi + while IFS= read -r -d $'\0' encryptedFile; do Logger "Decrypting [$encryptedFile]." "VERBOSE" #$CRYPT_TOOL --out "${encryptedFile%%$cryptFileExtension}" --batch --yes $secret --decrypt "$encryptedFile" > "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID" 2>&1 #WIP trying to resolve travis GPG mystery - $CRYPT_TOOL --out "${encryptedFile%%$cryptFileExtension}" --batch --yes $secret --decrypt "$encryptedFile" + $CRYPT_TOOL $options --out "${encryptedFile%%$cryptFileExtension}" $secret --decrypt "$encryptedFile" if [ $? != 0 ]; then Logger "Cannot decrypt [$encryptedFile]." "ERROR" Logger "Command output\n$(cat $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID)" "DEBUG"