lib/lib.sh, bin/make-cert: Fix usage message handling.
[distorted-letsencrypt] / bin / make-cert
CommitLineData
55799f78
MW
1#! /bin/sh
2set -e
93005620 3usage=" TAG"
55799f78
MW
4. "${0%/*}/../config.sh"
5. "$home/lib/lib.sh"
6
7run_as_user "$@"
8
9## Pick out the certificate tag.
10case $# in 0) fail_usage ;; esac
11tag=$1; shift
12case $# in 0) ;; *) fail_usage ;; esac
13
14prepare_tmp $tag
15
16## Get started.
17cd $home/cert/$tag
18openssl req -in req -out $tmp/req.der -outform der
19sans=$(openssl req -in req -text -noout |
20 sed -n '
21 x
22 /^ *X509v3 Subject Alternative Name: $/ {
23 x
24 s/ *DNS://g
25 s/,/ /g
26 p
27 x
28 }')
29make_le_conf $sans
30
31cat "$tmp/le.conf"