diff options
-rwxr-xr-x | scripts/mkreq | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/scripts/mkreq b/scripts/mkreq index 4493867..c5e8e9f 100755 --- a/scripts/mkreq +++ b/scripts/mkreq @@ -1,6 +1,5 @@ #!/bin/sh -host="$1"; shift ca_host="ca.sunet.se" ca_name="infra" type="" @@ -22,14 +21,21 @@ Usage: mkreq [-v] [-s*] [-c] [-C <ca host>] [-N <ca name>] [--] <fqdn> " 1>&2 } +if [ "x$1" = "x" ]; then + usage + exit 1 +fi + { while test $# -gt 0; do case "$1" in -s) type="server" + shift ;; -c) type="client" + shift ;; -C) ca_host="$2" @@ -46,11 +52,25 @@ Usage: mkreq [-v] [-s*] [-c] [-C <ca host>] [-N <ca name>] [--] <fqdn> --) break ;; + *) + echo $1 | grep -q '^-' || break # found the fqdn + echo "$0: Unknown option $1" + echo "" + usage + exit 1 esac - shift done } +host="$1" + +if [ "x$host" = "x" ]; then + echo "$0: No fqdn supplied" + echo "" + usage + exit 1 +fi + if [ -d $host -a -z $type ]; then type="server" fi |