updated setup/install_github_ssh_key.sh

pull/2/head
Hari Sekhon 5 years ago
parent c7d88fb950
commit f9a3b54dbd

@ -18,19 +18,14 @@
set -euo pipefail set -euo pipefail
[ -n "${DEBUG:-}" ] && set -x [ -n "${DEBUG:-}" ] && set -x
srcdir="$(dirname "$0")"
home="${HOME:-$(cd && pwd)}" home="${HOME:-$(cd && pwd)}"
authorized_keys="${AUTHORIZED_KEYS:-$home/.ssh/authorized_keys}" authorized_keys="${AUTHORIZED_KEYS:-$home/.ssh/authorized_keys}"
if [[ "$USER" =~ hari|sekhon ]]; then
GITHUB_USER="${GITHUB_USER:-harisekhon}"
else
GITHUB_USER="${GITHUB_USER:-$USER}"
fi
echo "Fetching SSH Key(s) from GitHub for account: $GITHUB_USER"
echo
while read -r ssh_key; do while read -r ssh_key; do
# skip comment lines
[ -z "$(sed 's/#.*//; /^[[:space:]]*$/d' <<< "$ssh_key")" ] && continue
echo "Processing key: $ssh_key" echo "Processing key: $ssh_key"
#algo_hash="$(awk '{print $1" "$2}' <<< "$ssh_key")" #algo_hash="$(awk '{print $1" "$2}' <<< "$ssh_key")"
algo_hash="${ssh_key%%==*}" algo_hash="${ssh_key%%==*}"
@ -43,5 +38,5 @@ while read -r ssh_key; do
echo "$ssh_key from GitHub" >> "$authorized_keys" echo "$ssh_key from GitHub" >> "$authorized_keys"
fi fi
echo echo
done < <(curl -s "https://github.com/$GITHUB_USER.keys") done < <("$srcdir/../github_get_user_ssh_public_key.sh")
echo Done echo Done

Loading…
Cancel
Save