Commit d2fed69d authored by Praveen Arimbrathodiyil's avatar Praveen Arimbrathodiyil
Browse files

fix the way variable is written to config file

parent 208ef43f
......@@ -16,7 +16,7 @@ set -e
# Store values from config file into
# debconf db.
db_set diaspora-common/url "$SERVERNAME"
db_set diaspora-common/ssl "$diaspora_https:-true"
db_set diaspora-common/ssl "${diaspora_https:-true}"
db_set diaspora-common/letsencrypt "${diaspora_letsencrypt:-false}"
fi
......
......@@ -63,8 +63,14 @@ case "$1" in
cp -a -f ${diaspora_conf_private} ${diaspora_conf_private}.tmp
# Read from debconf db
db_get diaspora-common/url
SERVERNAME=${RET}
db_get diaspora-common/ssl
diaspora_https=$RET
ENVIRONMENT_URL=https://$SERVERNAME
if [ "$diaspora_https" = "false" ]; then
ENVIRONMENT_URL=http://$SERVERNAME
fi
db_get diaspora-common/letsencrypt
diaspora_letsencrypt=$RET
......@@ -82,23 +88,10 @@ case "$1" in
< ${diaspora_conf_private} > ${diaspora_conf_private}.tmp
mv -f ${diaspora_conf_private}.tmp ${diaspora_conf_private}
# Configure pod address.
db_get diaspora-common/url
export SERVERNAME=${RET}
if ! grep SERVERNAME ${diaspora_conf_private}
then
echo export SERVERNAME=${SERVERNAME} >> ${diaspora_conf_private}
fi
# Get ssl choice
db_get diaspora-common/ssl
if [ "${RET}" = "true" ]; then
db_go
# Configure pod address.
if ! grep ENVIRONMENT_URL ${diaspora_conf_private}
then
echo export ENVIRONMENT_URL="https://$SERVERNAME" >> ${diaspora_conf_private}
fi
# Configure nginx if available
if which nginx > /dev/null 2>&1; then
echo "SSL enabled, configuring nginx for ${SERVERNAME}..."
......@@ -110,8 +103,7 @@ case "$1" in
db_go
# Check if letsencrypt option is selected
db_get diaspora-common/letsencrypt
if [ "${RET}" = "true" ]; then
if [ "$diaspora_letsencrypt" = "true" ]; then
echo "Configuring letsencrypt..."
mkdir -p /etc/diaspora/ssl
ln -sf /etc/letsencrypt/live/${SERVERNAME}/fullchain.pem \
......@@ -128,7 +120,7 @@ case "$1" in
echo "Stopping nginx for letsencrypt..."
invoke-rc.d nginx stop
fi
letsencrypt -d ${SERVERNAME} certonly || {
letsencrypt --standalone -d ${SERVERNAME} certonly || {
echo "letsencrypt auto configuration failed..."
echo "Stop your webserver and try running letsencrypt manually..."
echo "letsencrypt -d ${SERVERNAME} certonly"
......@@ -146,10 +138,6 @@ case "$1" in
else
echo "nginx not installed, skipping configuration..."
fi
if ! grep ENVIRONMENT_URL ${diaspora_conf_private}
then
echo export ENVIRONMENT_URL="http://$SERVERNAME" >> ${diaspora_conf_private}
fi
fi
# Check if user want to connect to some third party services
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment