Don't mount if usb is already mounted
This commit is contained in:
parent
4779327f75
commit
e94545a91a
|
@ -150,53 +150,55 @@ function search_for_attached_usb_drive {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [ -d $USB_DRIVE ]; then
|
if [ -d $USB_DRIVE ]; then
|
||||||
mount $USB_DRIVE /media/usb
|
if [ ! -d /media/usb ]; then
|
||||||
if [ -d /media/usb/Maildir ]; then
|
mount $USB_DRIVE /media/usb
|
||||||
echo 'Maildir found on USB drive'
|
fi
|
||||||
IMPORT_MAILDIR=/media/usb/Maildir
|
if [ -d /media/usb/Maildir ]; then
|
||||||
fi
|
echo 'Maildir found on USB drive'
|
||||||
if [ -d /media/usb/.gnupg ]; then
|
IMPORT_MAILDIR=/media/usb/Maildir
|
||||||
echo 'Importing GPG keyring'
|
fi
|
||||||
cp -r /media/usb/.gnupg /home/$MY_USERNAME/.gnupg
|
if [ -d /media/usb/.gnupg ]; then
|
||||||
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.gnupg
|
echo 'Importing GPG keyring'
|
||||||
shred -zu /media/usb/.gnupg/secring.gpg
|
cp -r /media/usb/.gnupg /home/$MY_USERNAME/.gnupg
|
||||||
shred -zu /media/usb/.gnupg/random_seed
|
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.gnupg
|
||||||
shred -zu /media/usb/.gnupg/trustdb.gpg
|
shred -zu /media/usb/.gnupg/secring.gpg
|
||||||
rm -rf /media/usb/.gnupg
|
shred -zu /media/usb/.gnupg/random_seed
|
||||||
fi
|
shred -zu /media/usb/.gnupg/trustdb.gpg
|
||||||
if [ -f /media/usb/private_key.gpg ]; then
|
rm -rf /media/usb/.gnupg
|
||||||
echo 'GPG private key found on USB drive'
|
fi
|
||||||
MY_GPG_PRIVATE_KEY=/media/usb/private_key.gpg
|
if [ -f /media/usb/private_key.gpg ]; then
|
||||||
fi
|
echo 'GPG private key found on USB drive'
|
||||||
if [ -f /media/usb/public_key.gpg ]; then
|
MY_GPG_PRIVATE_KEY=/media/usb/private_key.gpg
|
||||||
echo 'GPG public key found on USB drive'
|
fi
|
||||||
MY_GPG_PUBLIC_KEY=/media/usb/public_key.gpg
|
if [ -f /media/usb/public_key.gpg ]; then
|
||||||
fi
|
echo 'GPG public key found on USB drive'
|
||||||
if [ -d /media/usb/.ssh ]; then
|
MY_GPG_PUBLIC_KEY=/media/usb/public_key.gpg
|
||||||
echo 'Importing ssh keys'
|
fi
|
||||||
cp -r /media/usb/.ssh /home/$MY_USERNAME/.ssh
|
if [ -d /media/usb/.ssh ]; then
|
||||||
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh
|
echo 'Importing ssh keys'
|
||||||
# for security delete the ssh keys from the usb drive
|
cp -r /media/usb/.ssh /home/$MY_USERNAME/.ssh
|
||||||
shred -zu /media/usb/.ssh/id_rsa
|
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.ssh
|
||||||
shred -zu /media/usb/.ssh/id_rsa.pub
|
# for security delete the ssh keys from the usb drive
|
||||||
shred -zu /media/usb/.ssh/known_hosts
|
shred -zu /media/usb/.ssh/id_rsa
|
||||||
rm -rf /media/usb/.ssh
|
shred -zu /media/usb/.ssh/id_rsa.pub
|
||||||
fi
|
shred -zu /media/usb/.ssh/known_hosts
|
||||||
if [ -f /media/usb/.emacs ]; then
|
rm -rf /media/usb/.ssh
|
||||||
echo 'Importing .emacs file'
|
fi
|
||||||
cp -f /media/usb/.emacs /home/$MY_USERNAME/.emacs
|
if [ -f /media/usb/.emacs ]; then
|
||||||
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.emacs
|
echo 'Importing .emacs file'
|
||||||
fi
|
cp -f /media/usb/.emacs /home/$MY_USERNAME/.emacs
|
||||||
if [ -d /media/usb/.emacs.d ]; then
|
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.emacs
|
||||||
echo 'Importing .emacs.d directory'
|
fi
|
||||||
cp -r /media/usb/.emacs.d /home/$MY_USERNAME/.emacs.d
|
if [ -d /media/usb/.emacs.d ]; then
|
||||||
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.emacs.d
|
echo 'Importing .emacs.d directory'
|
||||||
fi
|
cp -r /media/usb/.emacs.d /home/$MY_USERNAME/.emacs.d
|
||||||
if [ -d /media/usb/personal ]; then
|
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.emacs.d
|
||||||
echo 'Importing personal directory'
|
fi
|
||||||
cp -r /media/usb/personal /home/$MY_USERNAME/personal
|
if [ -d /media/usb/personal ]; then
|
||||||
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/personal
|
echo 'Importing personal directory'
|
||||||
fi
|
cp -r /media/usb/personal /home/$MY_USERNAME/personal
|
||||||
|
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/personal
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
echo 'search_for_attached_usb_drive' >> $COMPLETION_FILE
|
echo 'search_for_attached_usb_drive' >> $COMPLETION_FILE
|
||||||
}
|
}
|
||||||
|
@ -1145,13 +1147,13 @@ function import_email {
|
||||||
fi
|
fi
|
||||||
if [ $IMPORT_MAILDIR ]; then
|
if [ $IMPORT_MAILDIR ]; then
|
||||||
if [ -d $IMPORT_MAILDIR ]; then
|
if [ -d $IMPORT_MAILDIR ]; then
|
||||||
echo 'Transfering email files'
|
echo 'Transfering email files'
|
||||||
cp -r $IMPORT_MAILDIR/* /home/$MY_USERNAME/Maildir/
|
cp -r $IMPORT_MAILDIR/* /home/$MY_USERNAME/Maildir/
|
||||||
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/Maildir
|
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/Maildir
|
||||||
else
|
else
|
||||||
echo "Email import directory $IMPORT_MAILDIR not found"
|
echo "Email import directory $IMPORT_MAILDIR not found"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo 'import_email' >> $COMPLETION_FILE
|
echo 'import_email' >> $COMPLETION_FILE
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue