Change muttrc to use imported gpg key ID

This commit is contained in:
Bob Mottram 2017-06-24 18:29:56 +01:00
parent 5f0aba7db3
commit 7c2df014a2
1 changed files with 5 additions and 2 deletions

View File

@ -95,8 +95,8 @@ function interactive_gpg_from_usb {
exit 725729 exit 725729
fi fi
CURR_EMAIL_ADDRESS=$USER@$HOSTNAME CURR_EMAIL_ADDRESS=$USER@$HOSTNAME
CURR_GPG_ID=$(gpg --list-keys $MY_EMAIL_ADDRESS | sed -n '2p' | sed 's/^[ \t]*//') CURR_GPG_ID=$(gpg --homedir=$HOME_DIR/.gnupg --list-keys $CURR_EMAIL_ADDRESS | sed -n '2p' | sed 's/^[ \t]*//')
CURR_GPG_BACKUP_ID=$(gpg --list-keys "(backup key)" | sed -n '2p' | sed 's/^[ \t]*//') CURR_GPG_BACKUP_ID=$(gpg --homedir=$HOME_DIR/.gnupg --list-keys "(backup key)" | sed -n '2p' | sed 's/^[ \t]*//')
echo $'Making backup copy of existing gpg keys' echo $'Making backup copy of existing gpg keys'
if [ -d $HOME_DIR/.gnupg ]; then if [ -d $HOME_DIR/.gnupg ]; then
@ -117,6 +117,9 @@ function interactive_gpg_from_usb {
if [ -d $HOME_DIR/.gnupg ]; then if [ -d $HOME_DIR/.gnupg ]; then
echo $'Setting permissions' echo $'Setting permissions'
gpg_set_permissions $MY_USERNAME gpg_set_permissions $MY_USERNAME
echo $"Updating muttrc for $MY_USERNAME"
CURR_GPG_ID=$(gpg --homedir=$HOME_DIR/.gnupg --list-keys $CURR_EMAIL_ADDRESS | sed -n '2p' | sed 's/^[ \t]*//')
sed -i "s|set pgp_encrypt_only_command.*|set pgp_encrypt_only_command=\"/usr/lib/mutt/pgpewrap gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --trust-model always --encrypt-to $CURR_GPG_ID -- -r %r -- %f\"|g" /home/$MY_USERNAME/.muttrc
fi fi
GPG_LOADING="no" GPG_LOADING="no"
dialog --title $"Recover Encryption Keys" \ dialog --title $"Recover Encryption Keys" \