1
0
mirror of https://github.com/wmnnd/nginx-certbot synced 2023-04-20 18:47:46 +08:00

Ask for confirmation to replace existing data only once

This commit is contained in:
Philipp 2019-01-01 22:05:43 +01:00
parent 4de77dc45d
commit b76f6f7feb

View File

@ -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