Ticket #18855: Portfile.2

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

postgresql-server-devel Portfile

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