27 lines
688 B
Bash
Executable File
27 lines
688 B
Bash
Executable File
#!/bin/sh
|
|
set -ev
|
|
|
|
cd $(realpath $(dirname "${0}"))/install
|
|
|
|
# Check prerequisites
|
|
[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1
|
|
|
|
# Populate database
|
|
export ECOGIS_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=')
|
|
envsubst <createdb.sql | lxc-attach -u 5432 -g 5432 postgres -- psql
|
|
|
|
# Configure EcoGIS
|
|
mkdir -p /srv/ecogis/conf
|
|
envsubst <srv/ecogis/conf/config.php >/srv/ecogis/conf/config.php
|
|
chown -R 8020:8020 /srv/ecogis/conf
|
|
|
|
# Install service
|
|
cp etc/init.d/ecogis /etc/init.d/ecogis
|
|
rc-update -u
|
|
|
|
# Stop services required for build
|
|
[ ! -z ${STOP_POSTGRES} ] && service postgres stop
|
|
|
|
# Register application
|
|
vmmgr register-app ecogis ecogis
|