exit 1
}
-
command=$1
config=$2
-shift 2
-user_args=""
-[ $# -lt 2 ] && {
- usage
-}
+user_args=""
while [ ${#} -gt 0 ]; do
- case "$command" in
+ case "${1}" in
--skip-prereqs)
SKIP_PREREQ="1"
user_args="$2"
shift
;;
- *)
- echo "Unknown options '${1}'"
- usage
- ;;
esac
shift 1
exit 0
}
-if [[ ! -e $config_file ]]
- then
+if [ -z "$command" -a -z "$config" ]; then
+ usage
+fi
+
+if [ ! "$command" == "setup" ]; then
+ if [[ ! -e $config_file ]]; then
echo "Config file was not found, ensure $config_file exists"
echo
echo "Available configs ( `cd containers && ls -dm *.yml | tr -s '\n' ' ' | awk '{ gsub(/\.yml/, ""); print }'`)"
exit 1
+ fi
fi
docker_version=($($docker_path --version))
set_config() {
if [ -f $config_file ]
then
- echo $config_file exists already.
+ echo $config_file exists already.
echo To remove it use: rm $config_file
exit 1
fi
else
echo "Unchanged."
fi
- fi
+ fi
if [ ! -z $developer_emails ]
then
read -p "developer_emails [$developer_emails]: " new_value
if [ "$smtp_address" == "smtp.sparkpostmail.com" ]
then
smtp_user_name="SMTP_Injection"
-
+
fi
if [ "$smtp_address" == "smtp.sendgrid.net" ]
then
else
echo "LETSENCRYPT will not be enabled."
fi
- echo
+ echo
read -p "Enter to write these settings to $config_file, 'N' to retry, or ^C to start again: " config_ok
done
rm $changelog
else
echo DISCOURSE_HOSTNAME change failed.
- update_ok="n"
+ update_ok="n"
fi
sed -i -e "s/^ DISCOURSE_DEVELOPER_EMAILS:.*/ DISCOURSE_DEVELOPER_EMAILS: \'$developer_emails\'/w $changelog" $config_file
rm $changelog
else
echo DISCOURSE_DEVELOPER_EMAILS change failed.
- update_ok="n"
+ update_ok="n"
fi
sed -i -e "s/^ DISCOURSE_SMTP_ADDRESS: smtp.example.com.*/ DISCOURSE_SMTP_ADDRESS: $smtp_address/w $changelog" $config_file
rm $changelog
else
echo DISCOURSE_SMTP_ADDRESS change failed.
- update_ok="n"
+ update_ok="n"
fi
sed -i -e "s/^ #DISCOURSE_SMTP_USER_NAME: user@example.com.*/ DISCOURSE_SMTP_USER_NAME: $smtp_user_name/w $changelog" $config_file
rm $changelog
else
echo DISCOURSE_SMTP_USER_NAME change failed.
- update_ok="n"
+ update_ok="n"
fi
sed -i -e "s/^ #DISCOURSE_SMTP_PASSWORD: pa\$\$word.*/ DISCOURSE_SMTP_PASSWORD: $smtp_password/w $changelog" $config_file
rm $changelog
else
echo DISCOURSE_SMTP_PASSWORD change failed.
- update_ok="n"
+ update_ok="n"
fi
if [ "$letsencrypt_status" != "change to enable" ]
rm $changelog
else
echo LETSENCRYPT_ACCOUNT_EMAIL change failed.
- update_ok="n"
+ update_ok="n"
fi
local src='^ #- "templates\/web.ssl.template.yml"'
local dst=' \- "templates\/web.ssl.template.yml"'
then
echo " web.ssl.template.yml enabled"
else
- update_ok="n"
+ update_ok="n"
echo " web.ssl.template.yml NOT ENABLED--was it on already?"
fi
local src='^ #- "templates\/web.letsencrypt.ssl.template.yml"'
local dst=' - "templates\/web.letsencrypt.ssl.template.yml"'
-
+
sed -i -e "s/$src/$dst/w $changelog" $config_file
if [ -s $changelog ]
then
echo " letsencrypt.ssl.template.yml enabled"
else
- update_ok="n"
+ update_ok="n"
echo "letsencrypt.ssl.template.yml NOT ENABLED--was it on already?"
fi
fi # enable letsencrypt