Skip to content

Commit

Permalink
Add some sanity checks
Browse files Browse the repository at this point in the history
* verify that CERT_DST is a directory and is readable
  • Loading branch information
dlangille committed Jul 21, 2017
1 parent 68f788c commit 9d8159a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cert-puller
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ sudo_examples(){
done
}

sanity_checks(){
if [ ! -r "${CERT_DST}" -o ! -d "${CERT_DST}" ]; then
${LOGGER} "${CERT_DST}" is NOT readable and a directory
${LOGGER} $0 exits
exit 2
fi
}

fetch_new_certs(){
# first, we fetch the certs are looking for.
${LOGGER} fetching into ${DOWNLOAD_DIR}
Expand Down Expand Up @@ -184,11 +192,13 @@ done
#
if [ ${SUDO_EXAMPLES} == "1" ]; then
sudo_examples
exit
exit 1
fi

${LOGGER} starting $0

sanity_checks

fetch_new_certs

install_new_certs
Expand Down

0 comments on commit 9d8159a

Please sign in to comment.