From bc7d08077a10caeecc3b8bcf941f883492b47357 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Sat, 21 May 2022 15:09:45 +0200 Subject: setup-user: add magic keywords for fetching ssh keys Use al, gh, and gl as magic keywords to suggest url for shs key --- setup-user.in | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/setup-user.in b/setup-user.in index 8f4047f..0801525 100644 --- a/setup-user.in +++ b/setup-user.in @@ -76,12 +76,30 @@ while true; do done if [ -n "$interactive" ] && [ -z "$keysopt" ]; then + suggest=none while true; do - ask "Enter ssh key or URL for $username (or 'none')" none + ask "Enter ssh key or URL for $username (or 'none')" $suggest case "$resp" in - none) break;; - https://*|http://*) sshkeys=$(wget -q -O- $resp | grep ^ssh-);; - *) sshkeys="$resp";; + al) + suggest="https://gitlab.alpinelinux.org/$username.keys" + continue + ;; + gl) + suggest="https://gitlab.com/$username.keys" + continue + ;; + gh) + suggest="https://github.com/$username.keys" + continue + ;; + none) + break + ;; + https://*|http://*) + sshkeys=$(wget -q -O- $resp | grep ^ssh-) + ;; + *) sshkeys="$resp" + ;; esac if echo "$sshkeys" | grep -q ^ssh-; then break -- cgit v1.2.3