From 7c2df014a2c0653932fcb3131756fff24a1f733d Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 24 Jun 2017 18:29:56 +0100 Subject: [PATCH] Change muttrc to use imported gpg key ID --- src/freedombone-utils-keys | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/freedombone-utils-keys b/src/freedombone-utils-keys index 20674234..452f4bb3 100755 --- a/src/freedombone-utils-keys +++ b/src/freedombone-utils-keys @@ -95,8 +95,8 @@ function interactive_gpg_from_usb { exit 725729 fi CURR_EMAIL_ADDRESS=$USER@$HOSTNAME - CURR_GPG_ID=$(gpg --list-keys $MY_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_ID=$(gpg --homedir=$HOME_DIR/.gnupg --list-keys $CURR_EMAIL_ADDRESS | 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' if [ -d $HOME_DIR/.gnupg ]; then @@ -117,6 +117,9 @@ function interactive_gpg_from_usb { if [ -d $HOME_DIR/.gnupg ]; then echo $'Setting permissions' 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 GPG_LOADING="no" dialog --title $"Recover Encryption Keys" \