Just check for gnupg directory

This commit is contained in:
Bob Mottram 2017-06-21 20:48:35 +01:00
parent 2798401e2f
commit 30dd79a83c
3 changed files with 1 additions and 7 deletions

View File

@ -48,9 +48,6 @@ GPG_KEYSERVER="hkp://keys.gnupg.net"
# whether to encrypt all incoming email with your public key # whether to encrypt all incoming email with your public key
GPG_ENCRYPT_STORED_EMAIL="yes" GPG_ENCRYPT_STORED_EMAIL="yes"
# gets set to yes if gpg keys are imported from usb
GPG_KEYS_IMPORTED="no"
# optionally you can provide your exported GPG key pair here # optionally you can provide your exported GPG key pair here
# Note that the private key file will be deleted after use # Note that the private key file will be deleted after use
# If these are unspecified then a new GPG key will be created # If these are unspecified then a new GPG key will be created
@ -1530,13 +1527,12 @@ function configure_gpg {
gpg_dir=/home/$MY_USERNAME/.gnupg gpg_dir=/home/$MY_USERNAME/.gnupg
# if gpg keys directory was previously imported from usb # if gpg keys directory was previously imported from usb
echo $"GPG keys imported: $GPG_KEYS_IMPORTED"
if [ -d $gpg_dir ]; then if [ -d $gpg_dir ]; then
echo $'GPG directory exists' echo $'GPG directory exists'
else else
echo $"GPG directory $gpg_dir was not found" echo $"GPG directory $gpg_dir was not found"
fi fi
if [[ $GPG_KEYS_IMPORTED == "yes" && -d $gpg_dir ]]; then if [ -d $gpg_dir ]; then
echo $'GPG keys were imported' echo $'GPG keys were imported'
sed -i "s|keyserver hkp://keys.gnupg.net|keyserver $GPG_KEYSERVER|g" $gpg_dir/gpg.conf sed -i "s|keyserver hkp://keys.gnupg.net|keyserver $GPG_KEYSERVER|g" $gpg_dir/gpg.conf
MY_GPG_PUBLIC_KEY_ID=$(gpg_pubkey_from_email "$MY_USERNAME" "$MY_EMAIL_ADDRESS") MY_GPG_PUBLIC_KEY_ID=$(gpg_pubkey_from_email "$MY_USERNAME" "$MY_EMAIL_ADDRESS")

View File

@ -240,7 +240,6 @@ function interactive_key_recovery {
${PROJECT_NAME}-recoverkey -u $MY_USERNAME ${PROJECT_NAME}-recoverkey -u $MY_USERNAME
if [ -d /home/$MY_USERNAME/.gnupg ]; then if [ -d /home/$MY_USERNAME/.gnupg ]; then
cp -rf /home/$MY_USERNAME/.gnupg /root cp -rf /home/$MY_USERNAME/.gnupg /root
GPG_KEYS_IMPORTED='yes'
fi fi
} }

View File

@ -259,7 +259,6 @@ function search_for_attached_usb_drive {
echo $'Importing GPG keyring' echo $'Importing GPG keyring'
cp -r $USB_MOUNT/.gnupg /home/$MY_USERNAME cp -r $USB_MOUNT/.gnupg /home/$MY_USERNAME
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.gnupg chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.gnupg
GPG_KEYS_IMPORTED="yes"
if [ ! -f /home/$MY_USERNAME/.gnupg/secring.gpg ]; then if [ ! -f /home/$MY_USERNAME/.gnupg/secring.gpg ]; then
echo $'GPG files did not copy' echo $'GPG files did not copy'
exit 73529 exit 73529