#!/bin/sh set -ev cd $(realpath $(dirname "${0}"))/install # 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 /srv/opendatakit-build/conf/config.yml lxc-execute opendatakit-build -- sh -c 'cd /srv/opendatakit-build; rake db:migrate' # Install service cp etc/init.d/opendatakit-build /etc/init.d/opendatakit-build rc-update -u # Stop services required for build [ ! -z ${STOP_POSTGRES} ] && service postgres stop # Register application vmmgr register-app opendatakit-build