arch-install/scripts/setup_gpg.sh

24 lines
605 B
Bash
Raw Normal View History

2024-06-07 14:31:41 +00:00
#!/usr/bin/env -S bash -i
2024-06-10 14:23:13 +00:00
copy_to_clipboard() {
if [[ "$OSTYPE" == "darwin"* ]]; then
pbcopy
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
xclip -selection clipboard
else
echo "Unsupported operating system"
exit 1
fi
}
2024-06-07 14:31:41 +00:00
echo "--- Grabbing GPG Passpharse from Bitwarden to clipboard"
2024-06-10 14:23:13 +00:00
rbw get "GPG Passphrase" | copy_to_clipboard
2024-06-07 14:31:41 +00:00
echo "--- Importing private/public key"
rbw get "GPG Private/Pub Key (Ariejan)" | gpg --import
echo "--- Setting key trust"
2024-06-07 14:32:49 +00:00
gpg --list-keys --fingerprint --with-colons |
sed -E -n -e 's/^fpr:::::::::([0-9A-F]+):$/\1:6:/p' |
gpg --import-ownertrust