Canonicalize paths and fix bug with cert generation
#!/bin/sh
-set -ex
+set -e
if [ "$1" = "" ]; then
echo "usage: $0 <bbs-ca.crt> <bbs-ca.key>"
@@ -8,11 +8,17 @@ if [ "$1" = "" ]; then
exit 1
fi
+set -x
+
+# Place keys and certificates here
+depot_path=$(readlink --canonicalize ./loggregator-certs)
+mkdir -p ${depot_path}
+
if [ "$1" = "no-bbs-ca" ]; then
bbs_ca_name="loggregator-ca"
else
- bbs_ca_cert_path=$1
- bbs_ca_key_path=$2
+ bbs_ca_cert_path=$(readlink --canonicalize ${1})
+ bbs_ca_key_path=$(readlink --canonicalize ${2})
bbs_ca_name=$(basename ${bbs_ca_cert_path} ".crt")
ln -s ${bbs_ca_cert_path} ${depot_path}/
ln -s ${bbs_ca_key_path} ${depot_path}/
@@ -21,10 +27,6 @@ fi
# Install certstrap
go get -v github.com/square/certstrap
-# Place keys and certificates here
-depot_path="loggregator-certs"
-mkdir -p ${depot_path}
-
# CA to distribute to loggregator certs
certstrap --depot-path ${depot_path} init --passphrase '' --common-name loggregatorCA
mv -f ${depot_path}/loggregatorCA.crt ${depot_path}/loggregator-ca.crt
