Download acme_tiny.py script automatically and bug fixing

This commit is contained in:
hoellen 2018-04-13 19:12:34 +02:00
parent 82c5e43aa6
commit c521114971

View File

@ -5,10 +5,10 @@ path="$( cd "$(dirname "$0")" ; pwd -P )"
#############
# variables
acme_dir=/srv/certs/acme-challenge/.well-known/acme-challenge
opt_folder=$path/opt
account_key=$opt_folder/account.key
acme_tiny=$opt_folder/acme_tiny.py
openssl_conf=$opt_folder/openssl.conf
opt_dir=/srv/certs/.opt
account_key=$opt_dir/account.key
acme_tiny=$opt_dir/acme_tiny.py
openssl_conf=$opt_dir/openssl.conf
#############
# script
@ -21,6 +21,11 @@ if [ $# -eq 0 ]; then
exit 1
fi
if [ ! -d "$opt_dir" ]; then
echo "opt dir doesn't exists!"
exit 1
fi
if [ ! -d "$acme_dir" ]; then
echo "acme directory ($acme_dir) doesn't exists!"
exit 1
@ -32,12 +37,13 @@ if [ ! -f "$account_key" ]; then
fi
if [ ! -f "$acme_tiny" ]; then
echo "Python script acme_tiny.py is missing"
echo "Python script acme_tiny.py is missing. Downloading..."
wget -qo $acme_tiny https://raw.githubusercontent.com/diafygi/acme-tiny/4.0.3/acme_tiny.py
exit 1
fi
acme_dir=${acme_dir%/}
opt_folder=${opt_folder%/}
opt_dir=${opt_dir%/}
# check if python is installed
command -v python >/dev/null 2>&1 || { echo >&2 "I require python but it's not installed. Aborting."; exit 1; }