From b76f6f7feb5a9e0270ebe6306d2c5a522d5f9889 Mon Sep 17 00:00:00 2001 From: Philipp Date: Tue, 1 Jan 2019 22:05:43 +0100 Subject: [PATCH] Ask for confirmation to replace existing data only once --- init-letsencrypt.sh | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/init-letsencrypt.sh b/init-letsencrypt.sh index 79869cf..4729015 100644 --- a/init-letsencrypt.sh +++ b/init-letsencrypt.sh @@ -6,24 +6,11 @@ data_path="./data/certbot" email="" # Adding a valid address is strongly recommended staging=0 # Set to 1 if you're testing your setup to avoid hitting request limits -if [ "$EUID" -ne 0 ]; then - read -p "You ran this script without root privileges, do you want to continue? (WARNING: script won't be able to delete generated by Let's Encrypt TLS certificates) (Y/n) " decision - case $decision in - [Y]* ) ;; - [n]* ) exit;; - * ) echo "Please choose the right variant (Y/n).";; - esac -fi - - -echo "### Preparing directories in $data_path ..." if [ -d "$data_path" ]; then - read -p "There is already folder with certbot data, do you want to remove it? (WARNING: removing folder will remove all data which is stored in the $data_path) (Y/n) " decision - case $decision in - [Y]* ) rm -rf "$data_path" && mkdir -p "$data_path";; - [n]* ) ;; - * ) echo "Please choose the right variant (Y/n).";; - esac + read -p "Existing data found for $domains. Continue and replace existing certificate? (y/N) " decision + if [ "$decision" != "Y" ] && [ "$decision" != "y" ]; then + exit + fi fi