Don't import gpg keys or email if this isn't a mailbox

This commit is contained in:
Bob Mottram 2014-09-24 20:15:53 +01:00
parent a31ae9c008
commit 868601d9b7
1 changed files with 27 additions and 24 deletions

View File

@ -205,31 +205,34 @@ function search_for_attached_usb_drive {
mkdir /media/usb mkdir /media/usb
mount $USB_DRIVE /media/usb mount $USB_DRIVE /media/usb
fi fi
if [ -d /media/usb/Maildir ]; then if ! [[ $SYSTEM_TYPE == "cloud" || $SYSTEM_TYPE == "chat" || $SYSTEM_TYPE == "social" ]]; then
echo 'Maildir found on USB drive' if [ -d /media/usb/Maildir ]; then
IMPORT_MAILDIR=/media/usb/Maildir echo 'Maildir found on USB drive'
fi IMPORT_MAILDIR=/media/usb/Maildir
if [ -d /media/usb/.gnupg ]; then fi
echo 'Importing GPG keyring' if [ -d /media/usb/.gnupg ]; then
cp -r /media/usb/.gnupg /home/$MY_USERNAME echo 'Importing GPG keyring'
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.gnupg cp -r /media/usb/.gnupg /home/$MY_USERNAME
if [ -f /home/$MY_USERNAME/.gnupg/secring.gpg ]; then chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.gnupg
shred -zu /media/usb/.gnupg/secring.gpg if [ -f /home/$MY_USERNAME/.gnupg/secring.gpg ]; then
shred -zu /media/usb/.gnupg/random_seed shred -zu /media/usb/.gnupg/secring.gpg
shred -zu /media/usb/.gnupg/trustdb.gpg shred -zu /media/usb/.gnupg/random_seed
rm -rf /media/usb/.gnupg shred -zu /media/usb/.gnupg/trustdb.gpg
else rm -rf /media/usb/.gnupg
echo 'GPG files did not copy' else
exit 7 echo 'GPG files did not copy'
exit 7
fi
fi
if [ -f /media/usb/private_key.gpg ]; then
echo 'GPG private key found on USB drive'
MY_GPG_PRIVATE_KEY=/media/usb/private_key.gpg
fi
if [ -f /media/usb/public_key.gpg ]; then
echo 'GPG public key found on USB drive'
MY_GPG_PUBLIC_KEY=/media/usb/public_key.gpg
fi fi
fi
if [ -f /media/usb/private_key.gpg ]; then
echo 'GPG private key found on USB drive'
MY_GPG_PRIVATE_KEY=/media/usb/private_key.gpg
fi
if [ -f /media/usb/public_key.gpg ]; then
echo 'GPG public key found on USB drive'
MY_GPG_PUBLIC_KEY=/media/usb/public_key.gpg
fi fi
if [ -d /media/usb/.ssh ]; then if [ -d /media/usb/.ssh ]; then
echo 'Importing ssh keys' echo 'Importing ssh keys'