Make the DEBUG variable more fool-proof.

This commit is contained in:
Disassembler 2017-09-26 12:52:05 +02:00
parent 8216e89c2f
commit 8402177b94
4 changed files with 13 additions and 6 deletions

View File

@ -1,6 +1,8 @@
#!/bin/bash #!/bin/bash
# For production builds change to DEBUG=0 or comment the line entirely
export DEBUG=1 export DEBUG=1
SOURCE_DIR=$(realpath $(dirname "${0}")) SOURCE_DIR=$(realpath $(dirname "${0}"))
${SOURCE_DIR}/01-basic.sh ${SOURCE_DIR}/01-basic.sh
@ -8,3 +10,8 @@ ${SOURCE_DIR}/02-sahana.sh
${SOURCE_DIR}/03-sambro.sh ${SOURCE_DIR}/03-sambro.sh
${SOURCE_DIR}/10-seeddms.sh ${SOURCE_DIR}/10-seeddms.sh
${SOURCE_DIR}/50-pandora.sh ${SOURCE_DIR}/50-pandora.sh
# Perform cleanup only if DEBUG environment variable is not set
if [ ${DEBUG:-0} -eq 0 ]; then
${SOURCE_DIR}/99-cleanup.sh
fi

View File

@ -125,8 +125,8 @@ apt-get -y --no-install-recommends -y install postgresql-9.6 postgresql-9.6-post
cp ${SOURCE_DIR}/basic/etc/postgresql/9.6/main/postgresql.conf /etc/postgresql/9.6/main/postgresql.conf cp ${SOURCE_DIR}/basic/etc/postgresql/9.6/main/postgresql.conf /etc/postgresql/9.6/main/postgresql.conf
cp ${SOURCE_DIR}/basic/etc/postgresql/9.6/main/pg_hba.conf /etc/postgresql/9.6/main/pg_hba.conf cp ${SOURCE_DIR}/basic/etc/postgresql/9.6/main/pg_hba.conf /etc/postgresql/9.6/main/pg_hba.conf
# Enable query logging. Only if the DEBUG environment variable exists # Enable query logging. Only if the DEBUG environment variable is set
if [ -n "${DEBUG}" ]; then if [ ${DEBUG:-0} -eq 1 ]; then
sed -i 's/#log_destination/log_destination/' /etc/postgresql/9.6/main/postgresql.conf sed -i 's/#log_destination/log_destination/' /etc/postgresql/9.6/main/postgresql.conf
sed -i 's/#logging_collector/logging_collector/' /etc/postgresql/9.6/main/postgresql.conf sed -i 's/#logging_collector/logging_collector/' /etc/postgresql/9.6/main/postgresql.conf
sed -i 's/#log_directory/log_directory/' /etc/postgresql/9.6/main/postgresql.conf sed -i 's/#log_directory/log_directory/' /etc/postgresql/9.6/main/postgresql.conf

View File

@ -52,8 +52,8 @@ chown -R sahana:sahana /srv/sahana
cd /srv/sahana cd /srv/sahana
sudo -u sahana python web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py sudo -u sahana python web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py
# Set "production values" (increases performance). Only if the DEBUG environment variable doesn't exist # Set "production values" (increases performance) only if the DEBUG environment variable is not set
if [ -z "${DEBUG}" ]; then if [ ${DEBUG:-0} -eq 0 ]; then
sed -i 's/settings.base.migrate = True/settings.base.migrate = False/' /srv/sahana/applications/eden/models/000_config.py sed -i 's/settings.base.migrate = True/settings.base.migrate = False/' /srv/sahana/applications/eden/models/000_config.py
sed -i 's/settings.base.debug = True/settings.base.debug = False/' /srv/sahana/applications/eden/models/000_config.py sed -i 's/settings.base.debug = True/settings.base.debug = False/' /srv/sahana/applications/eden/models/000_config.py
sed -i 's/#settings.base.prepopulate = 0/settings.base.prepopulate = 0/' /srv/sahana/applications/eden/models/000_config.py sed -i 's/#settings.base.prepopulate = 0/settings.base.prepopulate = 0/' /srv/sahana/applications/eden/models/000_config.py

View File

@ -52,8 +52,8 @@ chown -R sambro:sambro /srv/sambro
cd /srv/sambro cd /srv/sambro
sudo -u sambro python web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py sudo -u sambro python web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py
# Set "production values" (increases performance). Only if the DEBUG environment variable doesn't exist # Set "production values" (increases performance) only if the DEBUG environment variable is not set
if [ -z "${DEBUG}" ]; then if [ ${DEBUG:-0} -eq 0 ]; then
sed -i 's/settings.base.migrate = True/settings.base.migrate = False/' /srv/sambro/applications/eden/models/000_config.py sed -i 's/settings.base.migrate = True/settings.base.migrate = False/' /srv/sambro/applications/eden/models/000_config.py
sed -i 's/settings.base.debug = True/settings.base.debug = False/' /srv/sambro/applications/eden/models/000_config.py sed -i 's/settings.base.debug = True/settings.base.debug = False/' /srv/sambro/applications/eden/models/000_config.py
sed -i 's/#settings.base.prepopulate = 0/settings.base.prepopulate = 0/' /srv/sambro/applications/eden/models/000_config.py sed -i 's/#settings.base.prepopulate = 0/settings.base.prepopulate = 0/' /srv/sambro/applications/eden/models/000_config.py