IP_LOOKS_GOOD=0
if [[ ! -z $RESOLVED_IP ]]
then
- if [ $IP == $RESOLVED_IP ]
+ if [ "$IP" == "$RESOLVED_IP" ]
then
echo $1 resolves to $IP. Looks good!
echo
if [ $IP_LOOKS_GOOD == 0 ]
then
echo "-----------------------------------------"
- echo $1 does not resolve to $IP.
- echo IT IS ALMOST CERTAINLY A BAD IDEA TO TURN ON LET\'S ENCRYPT!!
- echo Unless you know why this check failed, DO NOT USE Let\'s Encrypt.
+ echo WARNING:: $1 does not appear to resolve to $IP.
+ echo ""
+ echo LET\'S ENCRYPT cannot work if their servers cannot access your host by name.
+ echo Unless you think you know why this naive check failed, DO NOT USE Let\'s Encrypt.
+ echo "(A typical reason for failure is an AWS server with an elastic IP.)"
echo
- echo You should answer \"n\" at the next prompt and disable Let\'s Encrypt.
- echo You have been warned.
+ echo You should probably answer \"n\" at the next prompt and disable Let\'s Encrypt.
echo "-----------------------------------------"
fi
sleep 1
os_type=$(check_OS)
avail_mem=0
- if [ $os_type == "Darwin" ]; then
+ if [ "$os_type" == "Darwin" ]; then
avail_mem=$(check_osx_memory)
else
avail_mem=$(check_linux_memory)
avail_gb=0
avail_cores=0
os_type=$(check_OS)
- if [ $os_type == "Darwin" ]; then
+ if [ "$os_type" == "Darwin" ]; then
avail_gb=$(check_osx_memory)
avail_cores=`sysctl hw.ncpu | awk '/hw.ncpu:/ {print $2}'`
else
fi
read_config "LETSENCRYPT_ACCOUNT_EMAIL"
local letsencrypt_account_email=$read_config_result
- if [ $letsencrypt_account_email = "me@example.com" ]
+ if [ -z $letsencrypt_account_email ]
+ then
+ letsencrypt_account_email="me@example.com"
+ fi
+ if [ "$letsencrypt_account_email" = "me@example.com" ]
then
local letsencrypt_status="ENTER to skip"
else
if [ "$letsencrypt_status" = "ENTER to skip" ]
then
- echo "Let's Encrypt will not be configured"
local src='^ #\?- "templates\/web.ssl.template.yml"'
local dst=' #\- "templates\/web.ssl.template.yml"'
sed -i -e "s/$src/$dst/w $changelog" $config_file
- if [ -s $changelog ]
+ if [ ! -s $changelog ]
then
- echo "web.ssl.template.yml disabled"
- else
update_ok="n"
echo "web.ssl.template.yml NOT DISABLED--Are you using a non-standard template?"
fi
local dst=' #- "templates\/web.letsencrypt.ssl.template.yml"'
sed -i -e "s/$src/$dst/w $changelog" $config_file
- if [ -s $changelog ]
+ if [ ! -s $changelog ]
then
- echo "letsencrypt.ssl.template.yml disabled"
- else
update_ok="n"
echo "web.ssl.template.yml NOT DISABLED--Are you using a non-standard template?"
fi
if (( result == 0 ))
then
- if [[ $config_line = *"$default"* ]]
+ if [[ "$config_line" = *"$default"* ]]
then
echo "$x left at incorrect default of example.com"
valid_config="n"
echo
echo ". . . reconfiguring . . ."
echo
+ DATE=`date +"%Y-%m-%d-%H%M%S"`
+ BACKUP=$app_name.yml.$DATE.bak
+ echo Saving old file as $BACKUP
+ cp $config_file containers/$BACKUP
+ echo
else
cp $template_path $config_file
fi