Make mkfile accept multiple parameters

This commit is contained in:
Lucas 2022-04-19 03:49:02 +00:00
parent cfd97ff74d
commit d630c83ade
2 changed files with 11 additions and 17 deletions

View file

@ -17,8 +17,8 @@ usage()
Usage:
${0##*/} issue [-hqv] [-I key_id] [-n principals]
[-V validity_interval]
${0##*/} mkfile authorized_keys [options]
${0##*/} mkfile known_hosts [hostnames]
${0##*/} mkfile authorized_keys [options ...]
${0##*/} mkfile known_hosts [hostnames ...]
EOF
exit 1
}
@ -181,17 +181,11 @@ main_mkfile()
case $file in
authorized_keys)
if [ $# -gt 1 ]; then
usage
fi
options=cert-authority${1:+,$1}
options=$(printf "%s\n" cert-authority "$@" | paste -sd , -)
printf "%s " "$options"
;;
known_hosts)
if [ $# -gt 1 ]; then
usage
fi
hostnames=${1:-}
hostnames=$(printf "%s\n" "$@" | paste -sd , -)
if [ -n "$hostnames" ]; then
printf "@cert-authority %s " "$hostnames"
else