#!/bin/sh set -ev cd $(realpath $(dirname "${0}"))/install # 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 /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 # Create admin account 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