Ticket #18855: Portfile

File Portfile, 1.5 KB (added by chepra@…, 16 years ago)

postgresql-server-devel Portfile

Line 
1# $Id$
2
3PortSystem 1.0
4
5name                    postgresql-server-devel
6version                 devel
7categories              databases
8platforms               darwin
9maintainers             nomaintainer
10description             run postgresql-devel as server
11long_description        ${description}
12
13homepage                http://www.postgresql.org/
14master_sites            postgresql
15
16depends_run             port:postgresql-devel
17
18fetch   {}
19checksum        {}
20extract {}
21use_configure   no
22build   {}
23
24set libdir              ${prefix}/lib/postgresql-devel
25set dbdir               ${prefix}/var/db/postgresql-devel/defaultdb
26set logdir              ${prefix}/var/log/postgresql-devel
27set dbuser              postgres
28set dbgrp               postgres
29
30startupitem.create      yes
31startupitem.init        \
32        "PGCTL=${libdir}/bin/pg_ctl"
33startupitem.start       \
34        "su ${dbuser} -c \"\${PGCTL} -D \${POSTGRESQLDEVELDATA:=${dbdir}} start -l ${logdir}/postgres.log\""
35startupitem.stop        \
36"su ${dbuser} -c \"\${PGCTL} -D \${POSTGRESQLDEVELDATA:=${dbdir}} stop -s -m fast\""
37
38destroot {
39        addgroup ${dbgrp}
40        set gid [existsgroup ${dbgrp}]
41        adduser ${dbuser} shell=/bin/sh gid=${gid} \
42                home=${prefix}/var/db/postgresql-devel \
43                realname=PostgreSQL-devel\ Server
44        xinstall -m 755 -d ${destroot}${logdir}
45        system "touch ${destroot}${logdir}/postgres.log"
46        system "chown ${dbuser}:${dbgrp} ${destroot}${logdir}/postgres.log"
47}
48
49post-install {
50        ui_msg "\nTo create a database instance, after install do\n\
51                sudo mkdir -p ${dbdir}\n\
52                sudo chown ${dbuser}:${dbgrp} ${dbdir}\n\
53                sudo su ${dbuser} -c \'${libdir}/bin/initdb -D ${dbdir}\'"
54        ui_msg "\nTo tweak your DBMS, consider increasing kern.sysv.shmmax\
55                by adding an increased kern.sysv.shmmax .. to /etc/sysctl.conf"
56}