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
# so that it may be imported at the beginning of new installs
GPG_TTY=$(tty)
export GPG_TTY
USER_EMAIL_ADDRESS=$MY_USERNAME@$HOSTNAME
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]*//')
@ -161,15 +164,15 @@ if [[ $MASTER_DRIVE == "yes" || $MASTER_DRIVE == "y" || $MASTER_DRIVE == "1" ]];
fi
backupgpgkey=$(gpg --armor --export $GPG_BACKUP_ID)
if [[ "$gpgkey" == *"$gpgerrstr"* ]]; then
echo $'Problem exporting public gpg key'
echo "$gpgkey"
if [[ "$backupgpgkey" == *"$gpgerrstr"* ]]; then
echo $'Problem exporting public gpg backup key'
echo "$backupgpgkey"
exit 735282
fi
backupgpgprivkey=$(gpg --armor --export-secret-key $GPG_BACKUP_ID)
if [[ "$gpgprivkey" == *"$gpgerrstr"* ]]; then
echo $'Problem exporting private gpg key'
echo "$gpgprivkey"
if [[ "$backupgpgprivkey" == *"$gpgerrstr"* ]]; then
echo $'Problem exporting private gpg backup key'
echo "$backupgpgprivkey"
gpgprivkey=
exit 629362
fi