Add comment sections, use CERT_DIR, add exit 0.
This commit is contained in:
parent
478cce43b5
commit
bf2fd2bb28
@ -1,6 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Create a real cert for each file in config/conf.d/.
|
# Create a real cert for each file in config/conf.d/.
|
||||||
|
|
||||||
|
## Variables ##
|
||||||
|
|
||||||
DIR=`dirname $0`
|
DIR=`dirname $0`
|
||||||
if [[ $DIR == \.* ]]; then
|
if [[ $DIR == \.* ]]; then
|
||||||
DIR=`pwd`
|
DIR=`pwd`
|
||||||
@ -10,8 +12,10 @@ fi
|
|||||||
CERT_DIR=$DIR/../../Volumes/ReverseProxy/letsencrypt-certs
|
CERT_DIR=$DIR/../../Volumes/ReverseProxy/letsencrypt-certs
|
||||||
echo "CERT_DIR=$CERT_DIR"
|
echo "CERT_DIR=$CERT_DIR"
|
||||||
|
|
||||||
|
## Validations ##
|
||||||
|
|
||||||
# Ensure that fake certs were created at some point, or that the system has been run at least once.
|
# Ensure that fake certs were created at some point, or that the system has been run at least once.
|
||||||
if [[ ! -d $DIR/../../Volumes/ReverseProxy/letsencrypt-certs ]]; then
|
if [[ ! -d $CERT_DIR ]]; then
|
||||||
echo "ERROR: Certificate directory does not exist yet. Run the placeholder script first." >&2
|
echo "ERROR: Certificate directory does not exist yet. Run the placeholder script first." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -23,6 +27,8 @@ if [[ $certbot_running != 1 ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
## Input ##
|
||||||
|
|
||||||
# Gather information from the user.
|
# Gather information from the user.
|
||||||
echo -n "Please provide the email address you would like the certs bound to: "
|
echo -n "Please provide the email address you would like the certs bound to: "
|
||||||
read email
|
read email
|
||||||
@ -39,6 +45,8 @@ if [[ $confirm != "Y"* ]]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
## Main ##
|
||||||
|
|
||||||
# Loop over the proxy configuration files and ensure they have certs.
|
# Loop over the proxy configuration files and ensure they have certs.
|
||||||
ls $DIR/config/conf.d/*.* | while read file; do
|
ls $DIR/config/conf.d/*.* | while read file; do
|
||||||
filename=`basename $file`
|
filename=`basename $file`
|
||||||
@ -71,3 +79,5 @@ ls $DIR/config/conf.d/*.* | while read file; do
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Create a fake cert for each file in config/conf.d/.
|
# Create a fake cert for each file in config/conf.d/.
|
||||||
|
|
||||||
|
## Variables ##
|
||||||
|
|
||||||
DIR=`dirname $0`
|
DIR=`dirname $0`
|
||||||
if [[ $DIR == \.* ]]; then
|
if [[ $DIR == \.* ]]; then
|
||||||
DIR=`pwd`
|
DIR=`pwd`
|
||||||
@ -10,8 +12,10 @@ fi
|
|||||||
CERT_DIR=$DIR/../../Volumes/ReverseProxy/letsencrypt-certs
|
CERT_DIR=$DIR/../../Volumes/ReverseProxy/letsencrypt-certs
|
||||||
echo "CERT_DIR=$CERT_DIR"
|
echo "CERT_DIR=$CERT_DIR"
|
||||||
|
|
||||||
|
## Main ##
|
||||||
|
|
||||||
# Create the directory if it does not exist.
|
# Create the directory if it does not exist.
|
||||||
mkdir -pv $DIR/../../Volumes/ReverseProxy/letsencrypt-certs
|
mkdir -pv $CERT_DIR
|
||||||
|
|
||||||
# Loop over the proxy configuration files and ensure they have certs.
|
# Loop over the proxy configuration files and ensure they have certs.
|
||||||
ls $DIR/config/conf.d/*.* | while read file; do
|
ls $DIR/config/conf.d/*.* | while read file; do
|
||||||
@ -29,3 +33,5 @@ ls $DIR/config/conf.d/*.* | while read file; do
|
|||||||
echo "Certs already exist!"
|
echo "Certs already exist!"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user