Tidying key recovery from usb
This commit is contained in:
parent
8409b0f198
commit
763544efd7
|
@ -955,8 +955,8 @@ function reconstruct_key {
|
||||||
}
|
}
|
||||||
|
|
||||||
function interactive_gpg_from_usb {
|
function interactive_gpg_from_usb {
|
||||||
dialog --title $"Encryption keys" \
|
dialog --title $"Recover Encryption Keys" \
|
||||||
--msgbox $'Plug in a USB drive containing a copy of your full key or key fragment' 6 70
|
--msgbox $'Plug in a USB keydrive containing a copy of your full key or key fragment' 6 70
|
||||||
|
|
||||||
HOME_DIR=/home/$MY_USERNAME
|
HOME_DIR=/home/$MY_USERNAME
|
||||||
GPG_LOADING="yes"
|
GPG_LOADING="yes"
|
||||||
|
@ -964,34 +964,17 @@ function interactive_gpg_from_usb {
|
||||||
GPG_CTR=0
|
GPG_CTR=0
|
||||||
while [[ $GPG_LOADING == "yes" ]]
|
while [[ $GPG_LOADING == "yes" ]]
|
||||||
do
|
do
|
||||||
if [[ $INSTALLING_ON_BBB == "yes" ]]; then
|
if [ ! -b $GPG_USB_DRIVE ]; then
|
||||||
GPG_USB_DRIVE='/dev/sda1'
|
if (( GPG_CTR > 0 )); then
|
||||||
if [ ! -b $GPG_USB_DRIVE ]; then
|
reconstruct_key
|
||||||
if (( GPG_CTR > 0 )); then
|
return 0
|
||||||
reconstruct_key
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
dialog --title $"Encryption keys" --msgbox $'No USB drive found' 6 30
|
|
||||||
exit 739836
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
GPG_USB_DRIVE='/dev/sdb1'
|
|
||||||
if [ ! -b $GPG_USB_DRIVE ]; then
|
|
||||||
GPG_USB_DRIVE='/dev/sdc1'
|
|
||||||
if [ ! -b $GPG_USB_DRIVE ]; then
|
|
||||||
GPG_USB_DRIVE='/dev/sdd1'
|
|
||||||
if [ ! -b $GPG_USB_DRIVE ]; then
|
|
||||||
if (( GPG_CTR > 0 )); then
|
|
||||||
reconstruct_key
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
dialog --title $"Encryption keys" --msgbox $'No USB drive found' 6 30
|
|
||||||
exit 27852
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
dialog --title $"Recover Encryption Keys" --msgbox $'No USB drive found' 6 30
|
||||||
|
exit 739836
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
detect_usb_drive
|
||||||
|
GPG_USB_DRIVE=$USB_DRIVE
|
||||||
GPG_USB_MOUNT='/mnt/usb'
|
GPG_USB_MOUNT='/mnt/usb'
|
||||||
umount -f $GPG_USB_MOUNT
|
umount -f $GPG_USB_MOUNT
|
||||||
if [ ! -d $GPG_USB_MOUNT ]; then
|
if [ ! -d $GPG_USB_MOUNT ]; then
|
||||||
|
@ -1013,7 +996,7 @@ function interactive_gpg_from_usb {
|
||||||
reconstruct_key
|
reconstruct_key
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
dialog --title $"Encryption keys" \
|
dialog --title $"Recover Encryption Keys" \
|
||||||
--msgbox $"There was a problem mounting the USB drive to $GPG_USB_MOUNT" 6 70
|
--msgbox $"There was a problem mounting the USB drive to $GPG_USB_MOUNT" 6 70
|
||||||
rm -rf $GPG_USB_MOUNT
|
rm -rf $GPG_USB_MOUNT
|
||||||
exit 74393
|
exit 74393
|
||||||
|
|
|
@ -135,6 +135,10 @@ if [[ $MASTER_DRIVE == "yes" || $MASTER_DRIVE == "y" || $MASTER_DRIVE == "1" ]];
|
||||||
exit 73025
|
exit 73025
|
||||||
fi
|
fi
|
||||||
cp -rf /home/$MY_USERNAME/.gnupg $USB_MOUNT
|
cp -rf /home/$MY_USERNAME/.gnupg $USB_MOUNT
|
||||||
|
if [ -d /etc/letsencrypt ]; then
|
||||||
|
cp -rf /etc/letsencrypt $USB_MOUNT
|
||||||
|
echo $"LetsEncrypt keys copied to $USB_DRIVE"
|
||||||
|
fi
|
||||||
if [ -d $USB_MOUNT/.gnupg ]; then
|
if [ -d $USB_MOUNT/.gnupg ]; then
|
||||||
echo $"GPG Keyring copied to $USB_DRIVE. You may now remove the drive."
|
echo $"GPG Keyring copied to $USB_DRIVE. You may now remove the drive."
|
||||||
else
|
else
|
||||||
|
|
|
@ -223,6 +223,12 @@ function interactive_gpg_from_usb {
|
||||||
if [ ! -d $HOME_DIR/.gnupg ]; then
|
if [ ! -d $HOME_DIR/.gnupg ]; then
|
||||||
mkdir $HOME_DIR/.gnupg
|
mkdir $HOME_DIR/.gnupg
|
||||||
fi
|
fi
|
||||||
|
if [ -d $GPG_USB_MOUNT/letsencrypt ]; then
|
||||||
|
test -r $GPG_USB_MOUNT/letsencrypt
|
||||||
|
if [ $? -ne ]; then
|
||||||
|
cp -rf $GPG_USB_MOUNT/letsencrypt /etc
|
||||||
|
fi
|
||||||
|
fi
|
||||||
cp -r $GPG_USB_MOUNT/.gnupg/* $HOME_DIR/.gnupg
|
cp -r $GPG_USB_MOUNT/.gnupg/* $HOME_DIR/.gnupg
|
||||||
GPG_LOADING="no"
|
GPG_LOADING="no"
|
||||||
dialog --title $"Encryption keys" \
|
dialog --title $"Encryption keys" \
|
||||||
|
|
Loading…
Reference in New Issue