From c3620b363636645224d9cc75eecce0b923d0da09 Mon Sep 17 00:00:00 2001 From: DJ Lucas Date: Mon, 13 Sep 2021 21:50:21 -0500 Subject: [PATCH] make-ca: guard overrides on first run. Closes #17. --- make-ca | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/make-ca b/make-ca index 97f8d7b..4dade7f 100644 --- a/make-ca +++ b/make-ca @@ -795,11 +795,14 @@ done unset tempfile # Backup any anchors with PKIX extensions - any object-id that is not 2.5.29.37 -mkdir -p ${TEMPDIR}/override -for file in $( grep -r "^object-id: 2\.5\.29\.[0-9]" "${ANCHORDIR}" | \ - grep -v "2\.5\.29\.37" | cut -d ":" -f 1); do - cp "${file}" "${TEMPDIR}/override/" -done +# only do if anchordir already exists +if test -d "${DESTDIR}${ANCHORDIR}"; then + mkdir -p ${TEMPDIR}/override + for file in $( grep -r "^object-id: 2\.5\.29\.[0-9]" "${DESTDIR}${ANCHORDIR}" | \ + grep -v "2\.5\.29\.37" | cut -d ":" -f 1); do + cp "${file}" "${TEMPDIR}/override/" + done +fi # Install anchors in $ANCHORDIR if test -d "${DESTDIR}${ANCHORDIR}"; then