From b0db9bee5da2239c3189c3462cf0526c5e1930c1 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Fri, 4 Jan 2019 22:50:24 -0700 Subject: [PATCH] added certificate path section --- setup.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/setup.sh b/setup.sh index 8043d7e..d572801 100644 --- a/setup.sh +++ b/setup.sh @@ -111,10 +111,52 @@ if [ "${useCertbot}" -eq 1 ]; then done fi +# not using Certbot: get location of certificate +while true; do + read -p "What is the path to your primary SSL certificate? " inputCertPath + case $inputCertPath in + '') + echo -e "\n${err}You cannot have an empty path to your SSL certificate${norm}" + ;; + [Xx]*) + echo -e "\n${cyan}---exiting---\n${norm}" + exit 1 + ;; + *) + # validate path + if [ -s "${inputCertPath}" ]; then + CertPath="${inputCertPath}" + break + else + echo -e "\n${warn}The file you specified doesn't exist or is empty" + while true; do + read -p "Do you want to use this path anyways? " yn + echo -e "${norm}" + case $yn in + [Yy]*) + CertPath="${inputCertPath}" + break + ;; + [Nn]*) + break + ;; + *) + ;; + esac + done + if [ -n "${CertPath}" ]; then + break + fi + fi + ;; + esac +done + # debug section echo "Local IP4: $IP4" echo "Using Certbot: $useCertbot" echo "CertbotDomain: $CertbotDomain" +echo "CertPath: $CertPath" exit 0