fix acme script downloading and better error handling
This commit is contained in:
		| @@ -37,20 +37,20 @@ if [ ! -d "$acme_dir" ]; then | ||||
|   exit 1 | ||||
| fi | ||||
|  | ||||
| if [ ! -f "$account_key" ]; then | ||||
| if [ ! -s "$account_key" ]; then | ||||
|   echo "Account Key doesn't exists!" | ||||
|   exit 1 | ||||
| fi | ||||
|  | ||||
| if [ ! -f "$acme_tiny" ]; then | ||||
|   echo "Python script acme_tiny.py is missing. Downloading... " | ||||
|   wget -qo $acme_tiny https://raw.githubusercontent.com/diafygi/acme-tiny/4.0.4/acme_tiny.py | ||||
| if [ ! -s "$acme_tiny" ]; then | ||||
|   echo -n "Python script acme_tiny.py is missing. Downloading... " | ||||
|   wget -qO "$acme_tiny" https://raw.githubusercontent.com/diafygi/acme-tiny/4.0.4/acme_tiny.py | ||||
|   if [ $? != 0 ]; then | ||||
|     echo "Could not download acme_tiny.py script." | ||||
|     rm -rf $acme_tiny | ||||
|     echo -ne "\nCould not download acme_tiny.py script.\n" | ||||
|     rm -rf "$acme_tiny" | ||||
|     exit 1 | ||||
|   fi | ||||
|   echo "Finished" | ||||
|   echo -ne "Finished\n" | ||||
| fi | ||||
|  | ||||
| acme_dir=${acme_dir%/} | ||||
| @@ -70,7 +70,7 @@ do | ||||
|     continue | ||||
|   fi | ||||
|  | ||||
|   if [ ! -f "$arg/domain.conf" ]; then | ||||
|   if [ ! -s "$arg/domain.conf" ]; then | ||||
|     echo "Configuration file doen't exists!" | ||||
|     continue | ||||
|   fi | ||||
| @@ -94,7 +94,7 @@ do | ||||
|   # domain key | ||||
|   key="$arg/$NAME.key" | ||||
|  | ||||
|   if [ ! -f "$key" ]; then | ||||
|   if [ ! -s "$key" ]; then | ||||
|     echo "Domain key doesn't exists. Generating..." | ||||
|     openssl genrsa 4096 > "$key" | ||||
|     #openssl ecparam -out "$key" -name secp384r1 -genkey | ||||
| @@ -103,7 +103,7 @@ do | ||||
|   # domain csr | ||||
|   csr="$arg/$NAME.csr" | ||||
|  | ||||
|   if [ ! -f "$csr" ]; then | ||||
|   if [ ! -s "$csr" ]; then | ||||
|     echo "Domain csr file doesn't exists. Generating..." | ||||
|     if [ ${#DOMAINS[@]} -eq 1 ]; then | ||||
|       # single domain | ||||
|   | ||||
		Reference in New Issue
	
	Block a user