diff --git a/home/.chezmoiscripts/universal/run_onchange_before_91-configure-gpg.tmpl b/home/.chezmoiscripts/universal/run_onchange_before_91-configure-gpg.tmpl index 07c8493e..20583a40 100644 --- a/home/.chezmoiscripts/universal/run_onchange_before_91-configure-gpg.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_before_91-configure-gpg.tmpl @@ -30,6 +30,11 @@ if [ -n "$KEYID" ] && command -v gpg > /dev/null; then if [ -n "$EXIT_CODE" ]; then logg error 'Failed to retrieve public user GPG key on hkps://pgp.mit.edu' gpgconf --kill dirmngr + KEYID="${KEYID^^}" + KEYID="$(echo "$KEYID" | sed 's/^0X/0x/')" + if [ -f "$HOME/.gnupg/$KEYID.key" ]; then + gpg --import "$HOME/.gnupg/$KEYID.key" + fi else logg success 'Successfully imported configured public user GPG key' fi