#!/bin/bash -e
# set pgsql postgres password

. /etc/default/inithooks

[ -e $INITHOOKS_CONF ] && . $INITHOOKS_CONF
$INITHOOKS_PATH/bin/pgsqlconf.py --user=postgres --pass="$DB_PASS"

# The appliance must accept connections after initial configuration, even if
# the password helper started PostgreSQL before its boot-time service did.
if [ "${RUN_FIRSTBOOT,,}" = true ]; then
    systemctl start postgresql
fi
