From ba24be237bf7127d8557cf34977d79381ce3e039 Mon Sep 17 00:00:00 2001 From: Brielle Date: Tue, 21 Mar 2017 16:26:32 -0600 Subject: [PATCH] Detect binary location --- gen-cert.sh | 20 +++++++++++++++++++- gen-unifi-cert.sh | 1 + 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/gen-cert.sh b/gen-cert.sh index 39ddc66..855861b 100755 --- a/gen-cert.sh +++ b/gen-cert.sh @@ -30,7 +30,25 @@ PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" PROXYAUTH="--standalone --standalone-supported-challenges http-01 --http-01-port 9999" # Location of LetsEncrypt binary we use -LEBINARY="/usr/src/letsencrypt/certbot-auto" +#LEBINARY="/usr/src/letsencrypt/certbot-auto" + +DEFAULTLEBINARY="/usr/bin/certbot /usr/bin/letsencrypt /usr/sbin/certbot + /usr/sbin/letsencrypt /usr/local/bin/certbot /usr/local/sbin/certbot + /usr/local/bin/letsencrypt /usr/local/sbin/letsencrypt + /usr/src/letsencrypt/certbot-auto /usr/src/letsencrypt/letsencrypt-auto + /usr/src/certbot/certbot-auto /usr/src/certbot/letsencrypt-auto + /usr/src/certbot-master/certbot-auto /usr/src/certbot-master/letsencrypt-auto" + +if [[ ! -v LEBINARY ]]; then + for i in ${DEFAULTLEBINARY}; do + if [[ -x ${i} ]]; then + LEBINARY=${i} + echo "Found LetsEncrypt/Certbot binary at ${LEBINARY}" + break + fi + done +fi + if [[ ! -x ${LEBINARY} ]]; then echo "Error: LetsEncrypt binary not found in ${LEBINARY} !" diff --git a/gen-unifi-cert.sh b/gen-unifi-cert.sh index d6ed603..acd2534 100755 --- a/gen-unifi-cert.sh +++ b/gen-unifi-cert.sh @@ -36,6 +36,7 @@ if [[ ! -v LEBINARY ]]; then for i in ${DEFAULTLEBINARY}; do if [[ -x ${i} ]]; then LEBINARY=${i} + echo "Found LetsEncrypt/Certbot binary at ${LEBINARY}" break fi done