diff --git a/src/freedombone-config b/src/freedombone-config index 8eab2cdf..d19725ed 100755 --- a/src/freedombone-config +++ b/src/freedombone-config @@ -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 [ -d $GPG_USB_MOUNT/.ssh ]; then - cp $GPG_USB_MOUNT/.ssh/* /home/$(grep 'MY_USERNAME' temp.cfg | awk -F '=' '{print $2}')/.ssh + if [[ $SSH_IMPORTED == "no" ]]; then + if [ -d $GPG_USB_MOUNT/.ssh ]; then + 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