Created
June 11, 2020 15:49
-
-
Save bobwaycott/687ab73a948f79decb8a652cc76ba6c9 to your computer and use it in GitHub Desktop.
Standalone script to import nodejs release team keyring for installing older versions of nodejs when using asdf from homebrew install
This file contains hidden or 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
#!/usr/bin/env bash | |
# INSTRUCTIONS | |
# Download file & `chmod +x` it | |
# Alternatively, you should be able to `curl` & pipe it to bash. | |
# Why? Because you can't run the recommended script unless you have a git-only `asdf` install. | |
set -o nounset -o pipefail -o errexit | |
plugin_name() { | |
basename "$(dirname "$(dirname "$0")")" | |
} | |
ASDF_NODEJS_KEYRING=asdf-nodejs.gpg | |
## Keys from https://github.com/nodejs/node/#release-keys | |
KEYS="94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \ | |
FD3A5288F042B6850C66B31F09FE44734EB7990E \ | |
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \ | |
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \ | |
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ | |
B9AE9905FFD7803F25714661B63B535A4C206CA9 \ | |
8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \ | |
77984A986EBC2AA786BC0F66B01FBB92821C587A \ | |
A48C2BEE680E841632CD4E44F07496B3EB3C1762 \ | |
4ED778F539E3634C779C87C6D7062848A1AB005C \ | |
B9E2F5981AA6E0CD28160D9FF13993A75599653C" | |
SERVERS="ha.pool.sks-keyservers.net | |
p80.pool.sks-keyservers.net:80 \ | |
ipv4.pool.sks-keyservers.net \ | |
keyserver.ubuntu.com | |
keyserver.ubuntu.com:80 \ | |
pgp.mit.edu | |
pgp.mit.edu:80" | |
OPTIONS="" | |
if [ -n "${http_proxy:-}" ]; | |
then OPTIONS="--keyserver-options http-proxy=$http_proxy"; | |
fi | |
gnugp_verify_command_name="$(command -v gpg gpg2 | head -n 1 || :)" | |
if [ -z "${gnugp_verify_command_name}" ]; then | |
echo 'gpg or gpg2 command not found!' >&2 | |
echo "You must install GnuPG to import release team keys: https://www.gnupg.org/" >&2 | |
exit 1 | |
fi | |
for key in $KEYS; do | |
for server in $SERVERS; do | |
$gnugp_verify_command_name --no-default-keyring --keyring ${ASDF_NODEJS_KEYRING} --no-tty --keyserver "hkp://$server" $OPTIONS --display-charset utf-8 --recv-keys "$key" && break | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment