dotfiles/run_once_setup-gpg.sh
2022-09-25 20:01:11 +02:00

15 lines
525 B
Bash

#!/bin/bash
set -e
exec 2> >(while read line; do echo -e "\e[01;31m$line\e[0m"; done)
MY_PGP_KEY_ID="A3F9CE82F38FC1F220CC2A1D63CCF3229371555E"
if ! gpg -k | grep "$MY_PGP_KEY_ID" > /dev/null; then
echo "Importing my public PGP key"
curl -s --tlsv1.3 https://tobias.strobel.one/pubkey.txt | gpg --import
echo "5\ny\n" | gpg --command-fd 0 --no-tty --batch --edit-key "$MY_PGP_KEY_ID" trust
fi
find "$HOME/.gnupg" -type f -not -path "*#*" -exec chmod 600 {} \;
find "$HOME/.gnupg" -type d -exec chmod 700 {} \;