Exporting backup key to keydrive

This commit is contained in:
Bob Mottram 2017-06-23 17:01:55 +01:00
parent 5831b29fb5
commit 839e129c5f
1 changed files with 9 additions and 6 deletions

View File

@ -141,6 +141,9 @@ if [[ $MASTER_DRIVE == "yes" || $MASTER_DRIVE == "y" || $MASTER_DRIVE == "1" ]];
# export the gpg key and backup key as text # export the gpg key and backup key as text
# so that it may be imported at the beginning of new installs # so that it may be imported at the beginning of new installs
GPG_TTY=$(tty)
export GPG_TTY
USER_EMAIL_ADDRESS=$MY_USERNAME@$HOSTNAME USER_EMAIL_ADDRESS=$MY_USERNAME@$HOSTNAME
GPG_ID=$(gpg --list-keys $USER_EMAIL_ADDRESS | sed -n '2p' | sed 's/^[ \t]*//') GPG_ID=$(gpg --list-keys $USER_EMAIL_ADDRESS | sed -n '2p' | sed 's/^[ \t]*//')
GPG_BACKUP_ID=$(gpg --list-keys "(backup key)" | sed -n '2p' | sed 's/^[ \t]*//') GPG_BACKUP_ID=$(gpg --list-keys "(backup key)" | sed -n '2p' | sed 's/^[ \t]*//')
@ -161,15 +164,15 @@ if [[ $MASTER_DRIVE == "yes" || $MASTER_DRIVE == "y" || $MASTER_DRIVE == "1" ]];
fi fi
backupgpgkey=$(gpg --armor --export $GPG_BACKUP_ID) backupgpgkey=$(gpg --armor --export $GPG_BACKUP_ID)
if [[ "$gpgkey" == *"$gpgerrstr"* ]]; then if [[ "$backupgpgkey" == *"$gpgerrstr"* ]]; then
echo $'Problem exporting public gpg key' echo $'Problem exporting public gpg backup key'
echo "$gpgkey" echo "$backupgpgkey"
exit 735282 exit 735282
fi fi
backupgpgprivkey=$(gpg --armor --export-secret-key $GPG_BACKUP_ID) backupgpgprivkey=$(gpg --armor --export-secret-key $GPG_BACKUP_ID)
if [[ "$gpgprivkey" == *"$gpgerrstr"* ]]; then if [[ "$backupgpgprivkey" == *"$gpgerrstr"* ]]; then
echo $'Problem exporting private gpg key' echo $'Problem exporting private gpg backup key'
echo "$gpgprivkey" echo "$backupgpgprivkey"
gpgprivkey= gpgprivkey=
exit 629362 exit 629362
fi fi