Skip to content

Instantly share code, notes, and snippets.

@2rs2ts
Forked from irgeek/bootlocal.sh
Created June 12, 2015 21:08
Show Gist options
  • Save 2rs2ts/87c33b5925d716a50a40 to your computer and use it in GitHub Desktop.
Save 2rs2ts/87c33b5925d716a50a40 to your computer and use it in GitHub Desktop.
#!/bin/sh
BOOT2DOCKER_CERTS_DIR=/var/lib/boot2docker/certs
CERTS_DIR=/etc/ssl/certs
CAFILE=${CERTS_DIR}/ca-certificates.crt
for cert in $(/bin/ls -1 ${BOOT2DOCKER_CERTS_DIR}); do
SRC_CERT_FILE=${BOOT2DOCKER_CERTS_DIR}/${cert}
CERT_FILE=${CERTS_DIR}/${cert}
HASH_FILE=${CERTS_DIR}/$(/usr/local/bin/openssl x509 -noout -hash -in ${SRC_CERT_FILE} 2>/dev/null)
[ ! -L ${CERT_FILE} ] && /bin/ln -fs ${SRC_CERT_FILE} ${CERT_FILE}
for idx in $(/usr/bin/seq 0 9); do
if [ -L ${HASH_FILE}.${idx} ]; then
[ "$(/usr/bin/readlink ${HASH_FILE}.${idx})" = "${SRC_CERT_FILE}" ] && break
else
/bin/ln -fs ${SRC_CERT_FILE} ${HASH_FILE}.${idx}
break
fi
done
#/bin/cat ${SRC_CERT_FILE} >> ${CAFILE}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment