make-ca: Fix DESTDIR if using a relative path.

This commit is contained in:
DJ Lucas 2021-08-07 19:32:18 -05:00
parent 51ffa79fa4
commit e02c930e6c

11
make-ca
View File

@ -74,6 +74,7 @@ function get_args(){
-D | --destdir) -D | --destdir)
check_arg $1 $2 check_arg $1 $2
DESTDIR="${2}" DESTDIR="${2}"
echo ${DESTDIR} | grep -q "^\." && DESTDIR="${PWD}/${DESTDIR}"
shift 2 shift 2
;; ;;
-P | --pkidir) -P | --pkidir)
@ -759,8 +760,10 @@ done
unset tempfile unset tempfile
# Install anchors in $ANCHORDIR # Install anchors in $ANCHORDIR
test -d "${DESTDIR}${ANCHORDIR}" && rm -rf "${DESTDIR}${ANCHORDIR}" if test -d "${DESTDIR}${ANCHORDIR}"; then
install -dm755 "${DESTDIR}${ANCHORDIR}" > /dev/null 2>&1 rm -rf "${DESTDIR}${ANCHORDIR}"
fi
install -dm755 "${DESTDIR}${ANCHORDIR}"
install -m644 "${TEMPDIR}"/pki/anchors/*.p11-kit "${DESTDIR}${ANCHORDIR}" install -m644 "${TEMPDIR}"/pki/anchors/*.p11-kit "${DESTDIR}${ANCHORDIR}"
# Install NSS Shared DB # Install NSS Shared DB
@ -869,7 +872,7 @@ fi
# Install certdata.txt # Install certdata.txt
if test "${REBUILD}" == "0"; then if test "${REBUILD}" == "0"; then
install -vdm755 "${DESTDIR}${SSLDIR}" install -dm755 "${DESTDIR}${SSLDIR}"
install -m644 "${WORKDIR}/certdata.txt" "${DESTDIR}${SSLDIR}/certdata.txt" install -m644 "${WORKDIR}/certdata.txt" "${DESTDIR}${SSLDIR}/certdata.txt"
fi fi
@ -880,7 +883,7 @@ rm -rf "${TEMPDIR}"
"${MD5SUM}" "${DESTDIR}${ANCHORDIR}"/* > "${DESTDIR}${ANCHORLIST}" "${MD5SUM}" "${DESTDIR}${ANCHORDIR}"/* > "${DESTDIR}${ANCHORLIST}"
# Build alternate formats using p11-kit trust # Build alternate formats using p11-kit trust
mkdir -p "${DESTDIR}${BUNDLEDIR}" "${DESTDIR}${KEYSTORE}" install -dm755 "${DESTDIR}${CERTDIR}" "${DESTDIR}${BUNDLEDIR}" "${DESTDIR}${KEYSTORE}"
echo -n "Extracting OpenSSL certificates to ${DESTDIR}${CERTDIR}..." echo -n "Extracting OpenSSL certificates to ${DESTDIR}${CERTDIR}..."
"${TRUST}" extract --filter=certificates --format=openssl-directory \ "${TRUST}" extract --filter=certificates --format=openssl-directory \
--overwrite --comment "${DESTDIR}${CERTDIR}" \ --overwrite --comment "${DESTDIR}${CERTDIR}" \