Commit bc7d0807 authored by Natanael Copa's avatar Natanael Copa
Browse files

setup-user: add magic keywords for fetching ssh keys

Use al, gh, and gl as magic keywords to suggest url for shs key
parent 1ce63fc4
Pipeline #123040 passed with stage
in 21 seconds
...@@ -76,12 +76,30 @@ while true; do ...@@ -76,12 +76,30 @@ while true; do
done done
if [ -n "$interactive" ] && [ -z "$keysopt" ]; then if [ -n "$interactive" ] && [ -z "$keysopt" ]; then
suggest=none
while true; do 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 case "$resp" in
none) break;; al)
https://*|http://*) sshkeys=$(wget -q -O- $resp | grep ^ssh-);; suggest="https://gitlab.alpinelinux.org/$username.keys"
*) sshkeys="$resp";; 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 esac
if echo "$sshkeys" | grep -q ^ssh-; then if echo "$sshkeys" | grep -q ^ssh-; then
break break
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment