Improving loading keys from usb

This commit is contained in:
Bob Mottram 2015-07-04 21:22:05 +01:00
parent 62be11f32c
commit 317a04ab5e
1 changed files with 22 additions and 4 deletions

View File

@ -312,7 +312,9 @@ function interactive_gpg_from_usb {
dialog --title "Encryption keys" \
--msgbox 'Plug in a USB drive containing a copy of your full key or key fragment' 6 70
HOME_DIR=/home/$MY_USERNAME
GPG_LOADING="yes"
SSH_IMPORTED="no"
GPG_CTR=0
while [[ $GPG_LOADING == "yes" ]]
do
@ -388,14 +390,30 @@ function interactive_gpg_from_usb {
fi
if [ -d $GPG_USB_MOUNT/.gnupg ]; then
cp -r $GPG_USB_MOUNT/.gnupg /home/$(grep 'MY_USERNAME' temp.cfg | awk -F '=' '{print $2}')
if [ ! -d $HOME_DIR/.gnupg ]; then
mkdir $HOME_DIR/.gnupg
fi
cp -r $GPG_USB_MOUNT/.gnupg/* $HOME_DIR/.gnupg
GPG_LOADING="no"
dialog --title "Encryption keys" \
--msgbox "GPG Keyring loaded to $HOME_DIR" 6 70
else
cp -r $GPG_USB_MOUNT/.gnupg_fragments /home/$(grep 'MY_USERNAME' temp.cfg | awk -F '=' '{print $2}')
if [ ! -d $HOME_DIR/.gnupg_fragments ]; then
mkdir $HOME_DIR/.gnupg_fragments
fi
cp -r $GPG_USB_MOUNT/.gnupg_fragments/* $HOME_DIR/.gnupg_fragments
fi
if [[ $SSH_IMPORTED == "no" ]]; then
if [ -d $GPG_USB_MOUNT/.ssh ]; then
cp $GPG_USB_MOUNT/.ssh/* /home/$(grep 'MY_USERNAME' temp.cfg | awk -F '=' '{print $2}')/.ssh
if [ ! -d $HOME_DIR/.ssh ]; then
mkdir $HOME_DIR/.ssh
fi
cp $GPG_USB_MOUNT/.ssh/* $HOME_DIR/.ssh
dialog --title "Encryption keys" \
--msgbox "ssh keys imported" 6 70
SSH_IMPORTED="yes"
fi
fi
umount -f $GPG_USB_MOUNT