Use version 1.50 beta (build 2478) of the modified 7-Zip SFX module
[msysgit/kirr.git] / src / curl / add-cert.sh
blob298d76050c35b1e844a8d21a55eb2d155d31c1a6
1 #!/bin/sh
3 die () {
4 echo "$*" >&2
5 exit 1
8 test $# = 0 &&
9 die "Usage: $0 <https hostname>"
11 cd "$(dirname "$0")" &&
12 host="$1"
13 host=${1#https://}
14 host=${host%%/*}
16 echo "Please press any key" >&2
17 out="$(openssl s_client -connect $host:443 </dev/null 2> /dev/null)" ||
18 die "Could not get certificate for $host"
20 mkdir -p certs &&
21 echo "$out" |
22 sed -n '/^-----BEGIN CERTIFICATE/,/^-----END CERTIFICATE/p' \
23 > certs/$host.pem