gpg_pass.sh 392 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#!/bin/bash

if [ $# -ne 1 ] ; then
  echo "Usage: gpg-pass.sh passfile additional-arguments..."
  exit 1
fi

PWD_FILE="$1"
shift 1

eval $(gpg-agent --daemon --allow-preset-passphrase --max-cache-ttl 7200)
cat ${PWD_FILE} | /usr/lib/gnupg/gpg-preset-passphrase --preset key:99F411D7
export GPG_TTY=`tty`
gpg  --batch --use-agent $@
/usr/lib/gnupg/gpg-preset-passphrase --forget key:99F411D7