Created
May 3, 2013 20:53
-
-
Save alexander-bauer/5514034 to your computer and use it in GitHub Desktop.
This script uses simple utilities to download a GPG public key over http and import it to the keyring.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## downloadkey.sh | |
## | |
## © 2013 Alexander Bauer, released under GPL-3+ | |
## The full text of GPL-3 can be found in /usr/share/common-licenses | |
## | |
# | |
# This script uses simple utilities to download a GPG public key over | |
# http and import it to the keyring. | |
# | |
if [ -z "$1" ]; then | |
echo "No URL provided." | |
exit 1 | |
fi | |
URL=$1 | |
DOWNLOADCMD="wget --quiet --output-document=-" | |
AWKCMD="awk" | |
GPGIMPORTCMD="gpg --import" | |
$DOWNLOADCMD $URL | $AWKCMD '$0 == "-----BEGIN PGP PUBLIC KEY BLOCK-----" { INKEY=1 }; INKEY; $0 == "-----END PGP PUBLIC KEY BLOCK-----" { exit 0; }' - | $GPGIMPORTCMD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment