Call gpg2 specifically instead of just gpg. Some systems have both gpg1 and gpg2, and we need gpg2.
This commit is contained in:
parent
267fbbbc9a
commit
523e7d4eb4
@ -24,7 +24,7 @@ muttHome=~/.mutt
|
|||||||
check_dependancies()
|
check_dependancies()
|
||||||
{
|
{
|
||||||
local dep
|
local dep
|
||||||
for dep in dialog gettext gpg mutt ; do
|
for dep in dialog gettext gpg2 mutt ; do
|
||||||
if ! command -v $dep &> /dev/null ; then
|
if ! command -v $dep &> /dev/null ; then
|
||||||
echo "$(eval_gettext "\$dep is not installed. Please install $dep and run this script again.")"
|
echo "$(eval_gettext "\$dep is not installed. Please install $dep and run this script again.")"
|
||||||
exit 1
|
exit 1
|
||||||
@ -207,8 +207,8 @@ EOF
|
|||||||
if [[ $(gpg --list-secret-keys | wc -l) -eq 0 ]]; then
|
if [[ $(gpg --list-secret-keys | wc -l) -eq 0 ]]; then
|
||||||
read -p "$(gettext "No gpg key was found. Type your name and press entr to generate a PGP key.control+c if you would like to create it manually.") " continue
|
read -p "$(gettext "No gpg key was found. Type your name and press entr to generate a PGP key.control+c if you would like to create it manually.") " continue
|
||||||
# Try to use quick key generation, and fall back to the more verbose version for legacy systems.
|
# Try to use quick key generation, and fall back to the more verbose version for legacy systems.
|
||||||
if ! gpg --quick-gen-key "${continue:-${USER}}"; then
|
if ! gpg2 --quick-gen-key "${continue:-${USER}}"; then
|
||||||
gpg --gen-key
|
gpg2 --gen-key
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
PS3="$(gettext "Select the key you want to use for encryption/signing:")"
|
PS3="$(gettext "Select the key you want to use for encryption/signing:")"
|
||||||
@ -217,7 +217,7 @@ EOF
|
|||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
keyName="$(gpg --list-secret-keys --keyid-format short | grep -B1 ^uid | head -n1 | rev | cut -c -8 | rev)"
|
keyName="$(gpg2 --list-secret-keys --keyid-format short | grep -B1 ^uid | head -n1 | rev | cut -c -8 | rev)"
|
||||||
echo "set pgp_sign_as=$keyName" >> "$muttHome/gpg.rc"
|
echo "set pgp_sign_as=$keyName" >> "$muttHome/gpg.rc"
|
||||||
fi
|
fi
|
||||||
# Create or update macro file
|
# Create or update macro file
|
||||||
@ -304,7 +304,7 @@ configure_gpg()
|
|||||||
fi
|
fi
|
||||||
# Make sure the configuration directory exists
|
# Make sure the configuration directory exists
|
||||||
if ! [ -d ~/.gnupg/ ]; then
|
if ! [ -d ~/.gnupg/ ]; then
|
||||||
gpg --list-secret-keys &> /dev/null
|
gpg2 --list-secret-keys &> /dev/null
|
||||||
fi
|
fi
|
||||||
if [ -f ~/.gnupg/gpg.conf ]; then
|
if [ -f ~/.gnupg/gpg.conf ]; then
|
||||||
read -p "$(gettext "This will overwrite your existing ~/.gnupg/gpg.conf file. Press enter to continue or control+c to abort. ")" continue
|
read -p "$(gettext "This will overwrite your existing ~/.gnupg/gpg.conf file. Press enter to continue or control+c to abort. ")" continue
|
||||||
@ -380,12 +380,12 @@ add_email_address()
|
|||||||
echo "$(gettext "The passwords do not match.")"
|
echo "$(gettext "The passwords do not match.")"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
keyName="$(gpg --list-secret-keys --keyid-format short | grep -B1 ^uid | head -n1 | rev | cut -c -8 | rev)"
|
keyName="$(gpg2 --list-secret-keys --keyid-format short | grep -B1 ^uid | head -n1 | rev | cut -c -8 | rev)"
|
||||||
# I wish it were possible to just echo the password through gpg and not have an unencrypted file at all.
|
# I wish it were possible to just echo the password through gpg and not have an unencrypted file at all.
|
||||||
# but either it's not, or I just can't figure out how to do it. So we'll use mktemp and shred.
|
# but either it's not, or I just can't figure out how to do it. So we'll use mktemp and shred.
|
||||||
passwordFile="$(mktemp)"
|
passwordFile="$(mktemp)"
|
||||||
echo -e "set imap_pass=\"$passOne\"\nset smtp_pass=\"$passOne\"" > "$passwordFile"
|
echo -e "set imap_pass=\"$passOne\"\nset smtp_pass=\"$passOne\"" > "$passwordFile"
|
||||||
gpg -r $keyName -e "$passwordFile"
|
gpg2 -r $keyName -e "$passwordFile"
|
||||||
mv "$passwordFile.gpg" "$muttHome/$emailAddress.gpg"
|
mv "$passwordFile.gpg" "$muttHome/$emailAddress.gpg"
|
||||||
shred -fuzn 10 "$passwordFile"
|
shred -fuzn 10 "$passwordFile"
|
||||||
echo "source \"gpg -d ${muttHome/#$HOME/\~}/${emailAddress}.gpg|\"" >> "$muttHome/$emailAddress"
|
echo "source \"gpg -d ${muttHome/#$HOME/\~}/${emailAddress}.gpg|\"" >> "$muttHome/$emailAddress"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user