From 396653c9a6a86f40dc9723619ef53e275ec9a5ef Mon Sep 17 00:00:00 2001 From: Disassembler Date: Thu, 25 Oct 2018 22:22:36 +0200 Subject: [PATCH] eliminate SOURCE_DIR --- 00-install.sh | 42 +++++++++++++++++++------------------- activemq/setup.sh | 4 ++-- ckan-datapusher/setup.sh | 10 ++++----- ckan/setup.sh | 20 +++++++++--------- crisiscleanup/setup.sh | 18 ++++++++-------- cts/setup.sh | 12 +++++------ frontlinesms/setup.sh | 6 +++--- gnuhealth/setup.sh | 10 ++++----- kanboard/setup.sh | 14 ++++++------- mariadb/setup.sh | 8 ++++---- mifosx/setup.sh | 16 +++++++-------- motech/setup.sh | 16 +++++++-------- opendatakit-build/setup.sh | 8 ++++---- opendatakit/setup.sh | 16 +++++++-------- openmapkit/setup.sh | 6 +++--- pandora/setup.sh | 16 +++++++-------- postgres/setup.sh | 8 ++++---- rabbitmq/setup.sh | 4 ++-- redis/setup.sh | 6 +++--- sahana-demo/setup.sh | 12 +++++------ sahana/setup.sh | 16 +++++++-------- sambro/setup.sh | 16 +++++++-------- seeddms/setup.sh | 16 +++++++-------- sigmah/setup.sh | 12 +++++------ solr/setup.sh | 4 ++-- ushahidi/setup.sh | 16 +++++++-------- 26 files changed, 166 insertions(+), 166 deletions(-) diff --git a/00-install.sh b/00-install.sh index 6d62547..d8780d6 100755 --- a/00-install.sh +++ b/00-install.sh @@ -4,31 +4,31 @@ set -e # For production builds change to DEBUG=0 or comment the line entirely export DEBUG=1 -SOURCE_DIR=$(realpath $(dirname "${0}")) +cd $(realpath $(dirname "${0}")) # Install shared packages and perform OS customization -${SOURCE_DIR}/basic.sh -${SOURCE_DIR}/basic-runtimes.sh +./basic.sh +./basic-runtimes.sh # Install applications -${SOURCE_DIR}/ckan.sh -# ${SOURCE_DIR}/crisiscleanup.sh -# ${SOURCE_DIR}/cts.sh -${SOURCE_DIR}/frontlinesms.sh -${SOURCE_DIR}/gnuhealth.sh -${SOURCE_DIR}/kanboard.sh -${SOURCE_DIR}/mifosx.sh -${SOURCE_DIR}/motech.sh -${SOURCE_DIR}/opendatakit-build.sh -${SOURCE_DIR}/opendatakit.sh -${SOURCE_DIR}/openmapkit.sh -${SOURCE_DIR}/pandora.sh -${SOURCE_DIR}/sahana.sh -${SOURCE_DIR}/sahana-demo.sh -${SOURCE_DIR}/sambro.sh -${SOURCE_DIR}/seeddms.sh -${SOURCE_DIR}/sigmah.sh -${SOURCE_DIR}/ushahidi.sh +./ckan.sh +# ./crisiscleanup.sh +# ./cts.sh +./frontlinesms.sh +./gnuhealth.sh +./kanboard.sh +./mifosx.sh +./motech.sh +./opendatakit-build.sh +./opendatakit.sh +./openmapkit.sh +./pandora.sh +./sahana.sh +./sahana-demo.sh +./sambro.sh +./seeddms.sh +./sigmah.sh +./ushahidi.sh # Perform cleanup only if DEBUG mode is not set [ ${DEBUG:-0} -eq 1 ] && exit 0 diff --git a/activemq/setup.sh b/activemq/setup.sh index 38d6129..5cf9807 100755 --- a/activemq/setup.sh +++ b/activemq/setup.sh @@ -1,12 +1,12 @@ #!/bin/sh set -e -SOURCE_DIR=$(realpath $(dirname "${0}"))/setup +cd $(realpath $(dirname "${0}"))/setup # Configure ActiveMQ mkdir -p /srv/activemq/data chown -R 61616:61616 /srv/activemq/data # Create service -cp ${SOURCE_DIR}/etc/init.d/activemq /etc/init.d/activemq +cp etc/init.d/activemq /etc/init.d/activemq rc-update -u diff --git a/ckan-datapusher/setup.sh b/ckan-datapusher/setup.sh index 147289a..c97e5ad 100755 --- a/ckan-datapusher/setup.sh +++ b/ckan-datapusher/setup.sh @@ -1,17 +1,17 @@ #!/bin/sh set -e -SOURCE_DIR=$(realpath $(dirname "${0}"))/setup +cd $(realpath $(dirname "${0}"))/setup # Configure CKAN DataPusher mkdir -p /srv/ckan-datapusher/conf /srv/ckan-datapusher/data -cp ${SOURCE_DIR}/srv/ckan-datapusher/conf/datapusher.wsgi /srv/ckan-datapusher/conf/datapusher.wsgi -cp ${SOURCE_DIR}/srv/ckan-datapusher/conf/datapusher_settings.py /srv/ckan-datapusher/conf/datapusher_settings.py +cp srv/ckan-datapusher/conf/datapusher.wsgi /srv/ckan-datapusher/conf/datapusher.wsgi +cp srv/ckan-datapusher/conf/datapusher_settings.py /srv/ckan-datapusher/conf/datapusher_settings.py chown -R 8004:8004 /srv/ckan-datapusher/data # Install service -cp ${SOURCE_DIR}/etc/init.d/ckan-datapusher /etc/init.d/ckan-datapusher +cp etc/init.d/ckan-datapusher /etc/init.d/ckan-datapusher rc-update -u # Install config update script -cp ${SOURCE_DIR}/srv/ckan-datapusher/update-conf.sh /srv/ckan-datapusher/update-conf.sh +cp srv/ckan-datapusher/update-conf.sh /srv/ckan-datapusher/update-conf.sh diff --git a/ckan/setup.sh b/ckan/setup.sh index 7b04060..887ab96 100755 --- a/ckan/setup.sh +++ b/ckan/setup.sh @@ -1,7 +1,7 @@ #!/bin/sh set -e -SOURCE_DIR=$(realpath $(dirname "${0}"))/setup +cd $(realpath $(dirname "${0}"))/setup # Check prerequisites [ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 @@ -11,12 +11,12 @@ SOURCE_DIR=$(realpath $(dirname "${0}"))/setup # Create database export CKAN_PWD=$(head -c 18 /dev/urandom | base64) export CKAN_DS_PWD=$(head -c 18 /dev/urandom | base64) -envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql +envsubst /srv/ckan/conf/ckan.ini -cp ${SOURCE_DIR}/srv/ckan/conf/who.ini /srv/ckan/conf/who.ini +envsubst /srv/ckan/conf/ckan.ini +cp srv/ckan/conf/who.ini /srv/ckan/conf/who.ini chown -R 8003:8003 /srv/ckan/data # Set "production values" (increases performance) only if the DEBUG environment variable is not set @@ -45,18 +45,18 @@ export CKAN_ADMIN_APIKEY=$(cat /proc/sys/kernel/random/uuid) export CKAN_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export CKAN_ADMIN_HASH=$(lxc-execute ckan -- python -c "from passlib.hash import pbkdf2_sha512;print pbkdf2_sha512.encrypt('${CKAN_ADMIN_PWD}')") export CKAN_ADMIN_EMAIL="admin@example.com" -envsubst <${SOURCE_DIR}/adminpwd.sql | lxc-attach -u 5432 -g 5432 postgres -- psql ckan +envsubst /srv/crisiscleanup/conf/database.yml -cp ${SOURCE_DIR}/srv/crisiscleanup/conf/boot.rb /srv/crisiscleanup/conf/boot.rb -cp ${SOURCE_DIR}/srv/crisiscleanup/conf/initializers/devise.rb /srv/crisiscleanup/conf/initializers/devise.rb -cp ${SOURCE_DIR}/srv/crisiscleanup/conf/environments/production.rb /srv/crisiscleanup/conf/environments/production.rb +envsubst /srv/crisiscleanup/conf/database.yml +cp srv/crisiscleanup/conf/boot.rb /srv/crisiscleanup/conf/boot.rb +cp srv/crisiscleanup/conf/initializers/devise.rb /srv/crisiscleanup/conf/initializers/devise.rb +cp srv/crisiscleanup/conf/environments/production.rb /srv/crisiscleanup/conf/environments/production.rb vmmgr update-login crisiscleanup "${CRISISCLEANUP_ADMIN_EMAIL}" "${CRISISCLEANUP_ADMIN_PWD}" # Populate database -envsubst <${SOURCE_DIR}/srv/crisiscleanup/db/seeds.rb >/var/lib/lxc/crisiscleanup/crisiscleanup/srv/crisiscleanup/db/seeds.rb +envsubst /var/lib/lxc/crisiscleanup/crisiscleanup/srv/crisiscleanup/db/seeds.rb lxc-execute crisiscleanup -- rake db:schema:load lxc-execute crisiscleanup -- rake db:seed # Install service -cp ${SOURCE_DIR}/etc/init.d/crisiscleanup /etc/init.d/crisiscleanup +cp etc/init.d/crisiscleanup /etc/init.d/crisiscleanup rc-update -u # Install config update script -cp ${SOURCE_DIR}/srv/crisiscleanup/update-conf.sh /srv/crisiscleanup/update-conf.sh +cp srv/crisiscleanup/update-conf.sh /srv/crisiscleanup/update-conf.sh # Stop services required for setup [ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/cts/setup.sh b/cts/setup.sh index c42b097..d7a8e34 100755 --- a/cts/setup.sh +++ b/cts/setup.sh @@ -1,14 +1,14 @@ #!/bin/sh set -e -SOURCE_DIR=$(realpath $(dirname "${0}"))/setup +cd $(realpath $(dirname "${0}"))/setup # Check prerequisites [ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 # Create database export CTS_PWD=$(head -c 18 /dev/urandom | base64) -envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql +envsubst /srv/cts/conf/spotter.py +envsubst /srv/cts/conf/spotter.py touch /srv/cts/conf/__init__.py # Set "production values" (increases performance) only if the DEBUG environment variable is not set @@ -32,15 +32,15 @@ export CTS_ADMIN_EMAIL=admin@example.com export CTS_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export CTS_ADMIN_HASH=$(lxc-execute cts -- python -c "from django.contrib.auth.hashers import make_password; print make_password('${CTS_ADMIN_PWD}')") export CTS_ADMIN_SECRET=$(head -c 12 /dev/urandom | sha256sum | cut -c1-13) -envsubst <${SOURCE_DIR}/adminpwd.sql | lxc-attach -u 5432 -g 5432 postgres -- psql cts +envsubst /srv/frontlinesms/data/app-settings.properties +envsubst /srv/frontlinesms/data/app-settings.properties chown -R 8018:8018 /srv/frontlinesms/data vmmgr update-login frontlinesms "${FRONTLINESMS_ADMIN_USER}" "${FRONTLINESMS_ADMIN_PWD}" # Install service -cp ${SOURCE_DIR}/etc/init.d/frontlinesms /etc/init.d/frontlinesms +cp etc/init.d/frontlinesms /etc/init.d/frontlinesms rc-update -u diff --git a/gnuhealth/setup.sh b/gnuhealth/setup.sh index 04e421f..90259f9 100755 --- a/gnuhealth/setup.sh +++ b/gnuhealth/setup.sh @@ -1,18 +1,18 @@ #!/bin/sh set -e -SOURCE_DIR=$(realpath $(dirname "${0}"))/setup +cd $(realpath $(dirname "${0}"))/setup # Check prerequisites [ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 # Create databases export GNUHEALTH_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '/+=') -envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql +envsubst /srv/gnuhealth/conf/trytond.conf +envsubst /srv/gnuhealth/conf/trytond.conf # Populate database export GNUHEALTH_ADMIN_USER="admin" @@ -28,11 +28,11 @@ zcat /tmp/gnuhealth_demo.sql.gz | lxc-attach -u 5432 -g 5432 postgres -- sh -c " rm -f /tmp/gnuhealth_demo.sql.gz # Install service -cp ${SOURCE_DIR}/etc/init.d/gnuhealth /etc/init.d/gnuhealth +cp etc/init.d/gnuhealth /etc/init.d/gnuhealth rc-update -u # Install config update script -cp ${SOURCE_DIR}/srv/gnuhealth/update-conf.sh /srv/gnuhealth/update-conf.sh +cp srv/gnuhealth/update-conf.sh /srv/gnuhealth/update-conf.sh # Stop services required for setup [ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/kanboard/setup.sh b/kanboard/setup.sh index d10e3cc..ed6e961 100755 --- a/kanboard/setup.sh +++ b/kanboard/setup.sh @@ -1,35 +1,35 @@ #!/bin/sh set -e -SOURCE_DIR=$(realpath $(dirname "${0}"))/setup +cd $(realpath $(dirname "${0}"))/setup # Check prerequisites [ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 # Populate database export KANBOARD_PWD=$(head -c 18 /dev/urandom | base64) -envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql +envsubst /srv/kanboard/conf/config.php +envsubst /srv/kanboard/conf/config.php export KANBOARD_ADMIN_USER=admin export KANBOARD_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export KANBOARD_ADMIN_HASH=$(python3 -c "import bcrypt; print(bcrypt.hashpw('${KANBOARD_ADMIN_PWD}'.encode(), bcrypt.gensalt()).decode().replace('2b', '2y'))") -envsubst <${SOURCE_DIR}/adminpwd.sql | lxc-attach -u 5432 -g 5432 postgres -- psql kanboard +envsubst /srv/mifosx/conf/context.xml -cp ${SOURCE_DIR}/srv/mifosx/conf/server.xml /srv/mifosx/conf/server.xml +envsubst /srv/mifosx/conf/context.xml +cp srv/mifosx/conf/server.xml /srv/mifosx/conf/server.xml # Install service -cp ${SOURCE_DIR}/etc/init.d/mifosx /etc/init.d/mifosx +cp etc/init.d/mifosx /etc/init.d/mifosx rc-update -u # Populate database @@ -38,11 +38,11 @@ export MIFOSX_ADMIN_USER=admin export MIFOSX_ADMIN_EMAIL=admin@example.com export MIFOSX_ADMIN_PWD=$(head -c 12 /dev/urandom | base64 | tr -d "+") export MIFOSX_ADMIN_HASH=$(echo -n "${MIFOSX_ADMIN_PWD}{1}" | sha256sum | awk '{print $1}') -envsubst <${SOURCE_DIR}/adminpwd.sql | lxc-attach mariadb -- mysql mifostenant-default +envsubst /srv/motech/conf/config/bootstrap.properties -cp ${SOURCE_DIR}/srv/motech/conf/config-locations.properties /srv/motech/conf/config-locations.properties -cp ${SOURCE_DIR}/srv/motech/conf/config/motech-settings.properties /srv/motech/conf/config/motech-settings.properties -cp ${SOURCE_DIR}/srv/motech/conf/config/org.motechproject.motech-platform-email/motech-email.properties /srv/motech/conf/config/org.motechproject.motech-platform-email/motech-email.properties +envsubst /srv/motech/conf/config/bootstrap.properties +cp srv/motech/conf/config-locations.properties /srv/motech/conf/config-locations.properties +cp srv/motech/conf/config/motech-settings.properties /srv/motech/conf/config/motech-settings.properties +cp srv/motech/conf/config/org.motechproject.motech-platform-email/motech-email.properties /srv/motech/conf/config/org.motechproject.motech-platform-email/motech-email.properties chown -R 8013:8013 /srv/motech/conf # Install service -cp ${SOURCE_DIR}/etc/init.d/motech /etc/init.d/motech +cp etc/init.d/motech /etc/init.d/motech rc-update -u # Populate database and create admin account @@ -38,7 +38,7 @@ service motech stop vmmgr update-login motech "${MOTECH_ADMIN_USER}" "${MOTECH_ADMIN_PWD}" # Install config update script -cp ${SOURCE_DIR}/srv/motech/update-conf.sh /srv/motech/update-conf.sh +cp srv/motech/update-conf.sh /srv/motech/update-conf.sh # Stop services required for build [ ! -z ${STOP_ACTIVEMQ} ] && service activemq stop diff --git a/opendatakit-build/setup.sh b/opendatakit-build/setup.sh index ce9d145..1d06054 100755 --- a/opendatakit-build/setup.sh +++ b/opendatakit-build/setup.sh @@ -1,23 +1,23 @@ #!/bin/sh set -e -SOURCE_DIR=$(realpath $(dirname "${0}"))/setup +cd $(realpath $(dirname "${0}"))/setup # Check prerequisites [ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 # Create databases export OPENDATAKITBUILD_PWD=$(head -c 18 /dev/urandom | base64) -envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres psql +envsubst /srv/opendatakit-build/conf/config.yml +envsubst /srv/opendatakit-build/conf/config.yml lxc-execute opendatakit-build -- sh -c 'cd /srv/opendatakit-build; rake db:migrate' # Install service -cp ${SOURCE_DIR}/etc/init.d/opendatakit-build /etc/init.d/opendatakit-build +cp etc/init.d/opendatakit-build /etc/init.d/opendatakit-build rc-update -u # Stop services required for build diff --git a/opendatakit/setup.sh b/opendatakit/setup.sh index 4a0e44e..aeb72b4 100755 --- a/opendatakit/setup.sh +++ b/opendatakit/setup.sh @@ -1,26 +1,26 @@ #!/bin/sh set -e -SOURCE_DIR=$(realpath $(dirname "${0}"))/setup +cd $(realpath $(dirname "${0}"))/setup # Check prerequisites [ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 # Create databases export OPENDATAKIT_PWD=$(head -c 18 /dev/urandom | base64) -envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql +envsubst /srv/opendatakit/conf/jdbc.properties -envsubst <${SOURCE_DIR}/srv/opendatakit/conf/security.properties >/srv/opendatakit/conf/security.properties -cp ${SOURCE_DIR}/srv/opendatakit/conf/server.xml /srv/opendatakit/conf/server.xml +envsubst /srv/opendatakit/conf/jdbc.properties +envsubst /srv/opendatakit/conf/security.properties +cp srv/opendatakit/conf/server.xml /srv/opendatakit/conf/server.xml chown -R 8015:8015 /srv/opendatakit/conf # Install service -cp ${SOURCE_DIR}/etc/init.d/opendatakit /etc/init.d/opendatakit +cp etc/init.d/opendatakit /etc/init.d/opendatakit rc-update -u # Populate database @@ -35,11 +35,11 @@ export OPENDATAKIT_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export OPENDATAKIT_ADMIN_SALT=$(head -c 4 /dev/urandom | hexdump -e '"%x"') # Must be 8 characters export OPENDATAKIT_ADMIN_BASIC_HASH=$(echo -n "${OPENDATAKIT_ADMIN_PWD}{${OPENDATAKIT_ADMIN_SALT}}" | sha1sum | tr -d " -") export OPENDATAKIT_ADMIN_DIGEST_HASH=$(echo -n "${OPENDATAKIT_ADMIN_USER}:${OPENDATAKIT_ADMIN_REALM}:${OPENDATAKIT_ADMIN_PWD}" | md5sum | tr -d " -") -envsubst <${SOURCE_DIR}/adminpwd.sql | lxc-attach -u 5432 -g 5432 postgres -- psql opendatakit +envsubst /srv/openmapkit/conf/settings.js +envsubst /srv/openmapkit/conf/settings.js vmmgr update-login openmapkit "${OPENMAPKIT_ADMIN_USER}" "${OPENMAPKIT_ADMIN_PWD}" # Install service -cp ${SOURCE_DIR}/etc/init.d/openmapkit /etc/init.d/openmapkit +cp etc/init.d/openmapkit /etc/init.d/openmapkit rc-update -u diff --git a/pandora/setup.sh b/pandora/setup.sh index 36465d7..2833b51 100755 --- a/pandora/setup.sh +++ b/pandora/setup.sh @@ -1,7 +1,7 @@ #!/bin/sh set -e -SOURCE_DIR=$(realpath $(dirname "${0}"))/setup +cd $(realpath $(dirname "${0}"))/setup # Check prerequisites [ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 @@ -9,7 +9,7 @@ SOURCE_DIR=$(realpath $(dirname "${0}"))/setup # Create PostgreSQL user and database export PANDORA_PWD=$(head -c 18 /dev/urandom | base64) -envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql +envsubst /srv/pandora/conf/local_settings.py +cp srv/pandora/conf/gunicorn_config.py /srv/pandora/conf/gunicorn_config.py +envsubst /srv/pandora/conf/local_settings.py # Set "production values" (increases performance) only if the DEBUG environment variable is not set if [ ${DEBUG:-0} -eq 0 ]; then @@ -46,15 +46,15 @@ export PANDORA_ADMIN_USER=admin export PANDORA_ADMIN_EMAIL=admin@example.com export PANDORA_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export PANDORA_ADMIN_HASH=$(lxc-execute pandora -- sh -c "DJANGO_SETTINGS_MODULE=srv.pandora.pandora.settings python3 -c \"from django.contrib.auth.hashers import make_password; print(make_password('${PANDORA_ADMIN_PWD}'))\"") -envsubst <${SOURCE_DIR}/adminpwd.sql | lxc-attach -u 5432 -g 5432 postgres -- psql pandora +envsubst /srv/sahana-demo/conf/000_config.py -envsubst <${SOURCE_DIR}/masterUsers.csv >/var/lib/lxc/sahana/sahana/tmp/masterUsers.csv +envsubst /srv/sahana-demo/conf/000_config.py +envsubst /var/lib/lxc/sahana/sahana/tmp/masterUsers.csv vmmgr update-login sahana-demo "${SAHANADEMO_ADMIN_USER}" "${SAHANADEMO_ADMIN_PWD}" # Replace template in LXC container mount definition @@ -33,11 +33,11 @@ lxc-execute -u 8001 -g 8001 sahana-demo -- sh -c 'cd /srv/web2py; cp /tmp/master rm /var/lib/lxc/sahana/sahana/tmp/masterUsers.csv # Install service -envsubst <${SOURCE_DIR}/etc/init.d/sahana-demo >/etc/init.d/sahana-demo +envsubst /etc/init.d/sahana-demo chmod +x /etc/init.d/sahana-demo # Install config update script -cp ${SOURCE_DIR}/srv/sahana-demo/update-conf.sh /srv/sahana-demo/update-conf.sh +cp srv/sahana-demo/update-conf.sh /srv/sahana-demo/update-conf.sh # Stop services required for build [ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/sahana/setup.sh b/sahana/setup.sh index 7ebb190..cec59bd 100755 --- a/sahana/setup.sh +++ b/sahana/setup.sh @@ -1,14 +1,14 @@ #!/bin/sh set -e -SOURCE_DIR=$(realpath $(dirname "${0}"))/setup +cd $(realpath $(dirname "${0}"))/setup # Check prerequisites [ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 # Create PostgreSQL user and database export SAHANA_PWD=$(head -c 18 /dev/urandom | base64) -envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql +envsubst /srv/sahana/conf/000_config.py -envsubst <${SOURCE_DIR}/srv/sahana/data/Spotter/masterUsers.csv >/srv/sahana/data/Spotter/masterUsers.csv -cp ${SOURCE_DIR}/srv/sahana/conf/00_settings.py /srv/sahana/conf/00_settings.py +envsubst /srv/sahana/conf/000_config.py +envsubst /srv/sahana/data/Spotter/masterUsers.csv +cp srv/sahana/conf/00_settings.py /srv/sahana/conf/00_settings.py vmmgr update-login sahana "${SAHANA_ADMIN_USER}" "${SAHANA_ADMIN_PWD}" # Populate database @@ -39,11 +39,11 @@ if [ ${DEBUG:-0} -eq 0 ]; then fi # Install service -cp ${SOURCE_DIR}/etc/init.d/sahana /etc/init.d/sahana +cp etc/init.d/sahana /etc/init.d/sahana rc-update -u # Install config update script -cp ${SOURCE_DIR}/srv/sahana/update-conf.sh /srv/sahana/update-conf.sh +cp srv/sahana/update-conf.sh /srv/sahana/update-conf.sh # Stop services required for build [ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/sambro/setup.sh b/sambro/setup.sh index cb9d369..c99856e 100755 --- a/sambro/setup.sh +++ b/sambro/setup.sh @@ -1,14 +1,14 @@ #!/bin/sh set -e -SOURCE_DIR=$(realpath $(dirname "${0}"))/setup +cd $(realpath $(dirname "${0}"))/setup # Check prerequisites [ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 # Create PostgreSQL user and database export SAMBRO_PWD=$(head -c 18 /dev/urandom | base64) -envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql +envsubst /srv/sambro/conf/000_config.py -envsubst <${SOURCE_DIR}/masterUsers.csv >/var/lib/lxc/sahana/sahana/tmp/masterUsers.csv -cp ${SOURCE_DIR}/srv/sambro/conf/00_settings.py /srv/sambro/conf/00_settings.py -cp ${SOURCE_DIR}/srv/sambro/data/SAMBRO/config.py /srv/sambro/data/SAMBRO/config.py +envsubst /srv/sambro/conf/000_config.py +envsubst /var/lib/lxc/sahana/sahana/tmp/masterUsers.csv +cp srv/sambro/conf/00_settings.py /srv/sambro/conf/00_settings.py +cp srv/sambro/data/SAMBRO/config.py /srv/sambro/data/SAMBRO/config.py vmmgr update-login sambro "${SAMBRO_ADMIN_USER}" "${SAMBRO_ADMIN_PWD}" # Populate database @@ -38,11 +38,11 @@ if [ ${DEBUG:-0} -eq 0 ]; then fi # Install service -cp ${SOURCE_DIR}/etc/init.d/sambro /etc/init.d/sambro +cp etc/init.d/sambro /etc/init.d/sambro rc-update -u # Install config update script -cp ${SOURCE_DIR}/srv/sambro/update-conf.sh /srv/sambro/update-conf.sh +cp srv/sambro/update-conf.sh /srv/sambro/update-conf.sh # Stop services required for build [ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/seeddms/setup.sh b/seeddms/setup.sh index 7513668..bb8b219 100755 --- a/seeddms/setup.sh +++ b/seeddms/setup.sh @@ -1,16 +1,16 @@ #!/bin/sh set -e -SOURCE_DIR=$(realpath $(dirname "${0}"))/setup +cd $(realpath $(dirname "${0}"))/setup # Check prerequisites [ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 # Populate database export SEEDDMS_PWD=$(head -c 18 /dev/urandom | base64) -envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql +envsubst /srv/seeddms/conf/settings.xml +envsubst /srv/seeddms/conf/settings.xml export SEEDDMS_ADMIN_USER=admin export SEEDDMS_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export SEEDDMS_ADMIN_EMAIL=admin@example.com -envsubst <${SOURCE_DIR}/adminpwd.sql | lxc-attach -u 5432 -g 5432 postgres -- psql seeddms +envsubst /srv/sigmah/conf/persistence.xml -cp ${SOURCE_DIR}/srv/sigmah/conf/sigmah.properties /srv/sigmah/conf/sigmah.properties +envsubst /srv/sigmah/conf/persistence.xml +cp srv/sigmah/conf/sigmah.properties /srv/sigmah/conf/sigmah.properties cp /var/lib/lxc/sigmah/sigmah/srv/tomcat/webapps/sigmah/sigmah/images/header/org-default-logo.png /srv/sigmah/data/files/logo.png # Populate database @@ -38,11 +38,11 @@ rm -f /tmp/sigmah-MinimumDataKit.sql /tmp/sigmah-newOrganizationLaunchScript.sql vmmgr update-login sigmah "${SIGMAH_ADMIN_EMAIL}" "${SIGMAH_ADMIN_PWD}" # Install service -cp ${SOURCE_DIR}/etc/init.d/sigmah /etc/init.d/sigmah +cp etc/init.d/sigmah /etc/init.d/sigmah rc-update -u # Install config update script -cp ${SOURCE_DIR}/srv/sigmah/update-conf.sh /srv/sigmah/update-conf.sh +cp srv/sigmah/update-conf.sh /srv/sigmah/update-conf.sh # Stop services required for build [ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/solr/setup.sh b/solr/setup.sh index a22e972..63f46dd 100755 --- a/solr/setup.sh +++ b/solr/setup.sh @@ -1,7 +1,7 @@ #!/bin/sh set -e -SOURCE_DIR=$(realpath $(dirname "${0}"))/setup +cd $(realpath $(dirname "${0}"))/setup # Configure Solr mkdir -p /srv/solr/data @@ -9,5 +9,5 @@ cp /var/lib/lxc/solr/solr/opt/solr/server/solr/solr.xml /srv/solr/data/solr.xml chown -R 8983:8983 /srv/solr/data # Install service -cp ${SOURCE_DIR}/etc/init.d/solr /etc/init.d/solr +cp etc/init.d/solr /etc/init.d/solr rc-update -u diff --git a/ushahidi/setup.sh b/ushahidi/setup.sh index 196f086..93df3c2 100755 --- a/ushahidi/setup.sh +++ b/ushahidi/setup.sh @@ -1,20 +1,20 @@ #!/bin/sh set -e -SOURCE_DIR=$(realpath $(dirname "${0}"))/setup +cd $(realpath $(dirname "${0}"))/setup # Check prerequisites [ ! -e /run/openrc/started/mariadb ] && service mariadb start && STOP_MARIADB=1 # Create database export USHAHIDI_PWD=$(head -c 18 /dev/urandom | base64) -envsubst <${SOURCE_DIR}/createdb.sql | lxc-attach mariadb -- mysql +envsubst /srv/ushahidi/conf/env -cp ${SOURCE_DIR}/srv/ushahidi/conf/config.json /srv/ushahidi/conf/config.json +envsubst /srv/ushahidi/conf/env +cp srv/ushahidi/conf/config.json /srv/ushahidi/conf/config.json # Populate database lxc-execute ushahidi -- /srv/ushahidi/platform/bin/phinx migrate -c /srv/ushahidi/platform/application/phinx.php @@ -23,18 +23,18 @@ lxc-execute ushahidi -- /srv/ushahidi/platform/bin/phinx migrate -c /srv/ushahid export USHAHIDI_ADMIN_USER=admin@example.com export USHAHIDI_ADMIN_PWD=$(head -c 12 /dev/urandom | base64) export USHAHIDI_ADMIN_HASH=$(python3 -c "import bcrypt; print(bcrypt.hashpw('${USHAHIDI_ADMIN_PWD}'.encode(), bcrypt.gensalt()).decode().replace('2b', '2y'))") -envsubst <${SOURCE_DIR}/adminpwd.sql | lxc-attach mariadb -- mysql ushahidi +envsubst