Don't generate gpg keys if they were imported from usb

This commit is contained in:
Bob Mottram 2014-09-29 10:40:42 +01:00
parent f0f52e3dca
commit 5833778775
1 changed files with 25 additions and 14 deletions

View File

@ -189,6 +189,9 @@ WIKI_SQLITE_ADDON_HASH="930335e647c7e62f3068689c256ee169fad2426b64f8360685d391ec
GPG_KEYSERVER="hkp://keys.gnupg.net"
# 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
# Note that the private key file will be deleted after use
# If these are unspecified then a new GPG key will be created
@ -384,6 +387,7 @@ function search_for_attached_usb_drive {
echo 'Importing GPG keyring'
cp -r $USB_MOUNT/.gnupg /home/$MY_USERNAME
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.gnupg
GPG_KEYS_IMPORTED="yes"
if [ -f /home/$MY_USERNAME/.gnupg/secring.gpg ]; then
shred -zu $USB_MOUNT/.gnupg/secring.gpg
shred -zu $USB_MOUNT/.gnupg/random_seed
@ -1279,6 +1283,13 @@ function configure_gpg {
fi
apt-get -y --force-yes install gnupg
# if gpg keys directory was previously imported from usb
if [[ $GPG_KEYS_IMPORTED == "yes" && -d /home/$MY_USERNAME/.gnupg ]]; then
sed -i "s|keyserver hkp://keys.gnupg.net|keyserver $GPG_KEYSERVER|g" /home/$MY_USERNAME/.gnupg/gpg.conf
echo 'configure_gpg' >> $COMPLETION_FILE
return
fi
if [ ! -d /home/$MY_USERNAME/.gnupg ]; then
mkdir /home/$MY_USERNAME/.gnupg
echo 'keyserver hkp://keys.gnupg.net' >> /home/$MY_USERNAME/.gnupg/gpg.conf