|
|
|
|
428
|
cp -r /home/$MY_USERNAME/.gnupg /root
|
428
|
cp -r /home/$MY_USERNAME/.gnupg /root
|
429
|
# get the first entry, which we assume to be the imported key
|
429
|
# get the first entry, which we assume to be the imported key
|
430
|
MY_GPG_PUBLIC_KEY_ID=$(gpg --list-keys | grep "pub " | head -n 1 | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}')
|
430
|
MY_GPG_PUBLIC_KEY_ID=$(gpg --list-keys | grep "pub " | head -n 1 | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}')
|
431
|
- fi
|
|
|
432
|
-
|
|
|
433
|
- # make sure that the root user has access to your gpg public key
|
|
|
434
|
- if [ $MY_GPG_PUBLIC_KEY_ID ]; then
|
|
|
435
|
- su -c "gpg --export-ownertrust > ~/temp_trust.txt" - $MY_USERNAME
|
|
|
436
|
- su -c "gpg --output $MY_GPG_PUBLIC_KEY --armor --export $MY_GPG_PUBLIC_KEY_ID" - $MY_USERNAME
|
|
|
437
|
- su -c "gpg --output ~/temp_private_key.txt --armor --export-secret-key $MY_GPG_PUBLIC_KEY_ID" - $MY_USERNAME
|
|
|
438
|
- gpg --import-ownertrust < /home/$MY_USERNAME/temp_trust.txt
|
|
|
439
|
- gpg --import $MY_GPG_PUBLIC_KEY
|
|
|
440
|
- gpg --allow-secret-key-import --import /home/$MY_USERNAME/temp_private_key.txt
|
|
|
441
|
- shred -zu /home/$MY_USERNAME/temp_private_key.txt
|
|
|
442
|
- shred -zu /home/$MY_USERNAME/temp_trust.txt
|
|
|
|
|
431
|
+ else
|
|
|
432
|
+ # make sure that the root user has access to your gpg public key
|
|
|
433
|
+ if [ $MY_GPG_PUBLIC_KEY_ID ]; then
|
|
|
434
|
+ su -c "gpg --export-ownertrust > ~/temp_trust.txt" - $MY_USERNAME
|
|
|
435
|
+ su -c "gpg --output $MY_GPG_PUBLIC_KEY --armor --export $MY_GPG_PUBLIC_KEY_ID" - $MY_USERNAME
|
|
|
436
|
+ su -c "gpg --output ~/temp_private_key.txt --armor --export-secret-key $MY_GPG_PUBLIC_KEY_ID" - $MY_USERNAME
|
|
|
437
|
+ gpg --import-ownertrust < /home/$MY_USERNAME/temp_trust.txt
|
|
|
438
|
+ gpg --import $MY_GPG_PUBLIC_KEY
|
|
|
439
|
+ gpg --allow-secret-key-import --import /home/$MY_USERNAME/temp_private_key.txt
|
|
|
440
|
+ shred -zu /home/$MY_USERNAME/temp_private_key.txt
|
|
|
441
|
+ shred -zu /home/$MY_USERNAME/temp_trust.txt
|
|
|
442
|
+ fi
|
443
|
fi
|
443
|
fi
|
444
|
}
|
444
|
}
|
445
|
|
445
|
|