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