# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
maintainers {jwa @jyrkiwahlstedt}
description run ${rname} as server
long_description ${description}
homepage https://www.postgresql.org/
depends_run port:${rname}
set libdir ${prefix}/lib/${rname}
set dbdir ${prefix}/var/db/${rname}/defaultdb
set logdir ${prefix}/var/log/${rname}
set dbhome ${prefix}/var/db/${rname}
add_users ${dbuser} shell=/bin/sh group=${dbgrp} \
realname=PostgreSQL-93\ Server
"PGCTL=${libdir}/bin/pg_ctl"
"su ${dbuser} -c \"\${PGCTL} -D \${POSTGRESQL93DATA:=${dbdir}} start -l ${logdir}/postgres.log\""
"su ${dbuser} -c \"\${PGCTL} -D \${POSTGRESQL93DATA:=${dbdir}} stop -s -m fast\""
xinstall -m 755 -d ${destroot}${logdir}
system "touch ${destroot}${logdir}/postgres.log"
system "chown ${dbuser}:${dbgrp} ${destroot}${logdir}/postgres.log"
notes "\nTo create a database instance, after install do\n\
sudo mkdir -p ${dbdir}\n\
sudo chown ${dbuser}:${dbgrp} ${dbdir}\n\
sudo su ${dbuser} -c \'cd ${dbhome} && ${libdir}/bin/initdb -D ${dbdir}\' "