Ticket #19238: Portfile-pgbouncer.diff

File Portfile-pgbouncer.diff, 2.8 KB (added by giorgio_v@…, 16 years ago)
  • Portfile

    old new  
    1 # $Id: Portfile 40948 2008-10-18 20:05:04Z ryandesign@macports.org $
     1# $Id$
    22
    33PortSystem 1.0
    44
    55name                    pgbouncer
    6 version                 1.2.3
     6version                 1.3
     7revision                0
    78categories              databases
    89platforms               darwin
    910maintainers             mac.com:giorgio_v
     
    1516                        server, or to reuse one of its existing connections.
    1617
    1718homepage                http://pgbouncer.projects.postgresql.org/
    18 master_sites            http://pgfoundry.org/frs/download.php/1873/
    19 checksums               md5 e8afc79103cd464c109a56e418a9ba24 \
    20                         sha1 597773beec654e1e27ba1a831e7136e498086b6f \
    21                         rmd160 7942991ef8dc206bd00f6dbba3c3e05d0a5b5b85
     19master_sites            http://pgfoundry.org/frs/download.php/2092/
     20checksums               md5 95f79289ccb8322758c608015e31f1f5 \
     21                        sha1 a86d5b5025affd38270c30fccdc1fde5ede3ff7f \
     22                        rmd160 581cf06c22567300fb38cfc1f212d44a8d770af5
     23
     24set dbuser              postgres
     25set dbgrp               postgres
     26set pg_version          83
    2227
    23 configure.env           PATH=$env(PATH):${prefix}/lib/postgresql83/bin
     28configure.env           PATH=$env(PATH):${prefix}/lib/postgresql$pg_version/bin
    2429
    25 depends_build           port:postgresql83
     30depends_build           port:postgresql$pg_version
    2631depends_lib             port:libevent
    2732
     33
     34post-destroot {
     35    xinstall -d -m 755 ${destroot}${prefix}/etc/${name}
     36    foreach f {pgbouncer.ini userlist.txt} {
     37            xinstall -m 644 -W ${worksrcpath}/etc $f ${destroot}${prefix}/etc/${name}/$f.sample
     38    }
     39}
     40
     41post-activate {
     42    if {![file exists ${prefix}/etc/${name}/pgbouncer.ini]} {
     43        ui_msg "To customize pgbouncer, copy pgbouncer.ini.sample and userlist.txt.sample"
     44        ui_msg "to pgbouncer.ini and userlist.txt in ${prefix}/etc/${name} and then make changes."
     45    }
     46    if {![file exists ${prefix}/var/db/postgresql$pg_version/.pgpass]} {
     47        system "touch ${prefix}/var/db/postgresql$pg_version/.pgpass"
     48        system "chown ${dbuser}:${dbgrp} ${prefix}/var/db/postgresql$pg_version/.pgpass"
     49        system "chmod 600 ${prefix}/var/db/postgresql$pg_version/.pgpass"
     50        ui_msg "Please configure ${prefix}/var/db/postgresql$pg_version/.pgpass"
     51    }
     52}
     53
     54startupitem.create      yes
     55startupitem.init        \
     56        "PGBOUNCER=${prefix}/bin/pgbouncer" \
     57        "PGPASS=${prefix}/var/db/postgresql$pg_version/.pgpass"
     58startupitem.start       \
     59        "su ${dbuser} -c \"\${PGBOUNCER} -dR ${prefix}/etc/pgbouncer/pgbouncer.ini\""
     60startupitem.stop        \
     61        "su ${dbuser} -c \"${prefix}/bin/psql$pg_version -h localhost -p 6543 -U $dbuser pgbouncer -c SHUTDOWN\""
     62
     63
    2864livecheck.check regex
    2965livecheck.url   http://pgfoundry.org/frs/?group_id=1000258
    3066livecheck.regex pgbouncer-(\[0-9\\.\]+)\\.tgz
    3167
    3268variant postgresql82 description {uses postgresql82 installation} {
    33         depends_build           port:postgresql82
    34         configure.env           PATH=$env(PATH):${prefix}/lib/postgresql82/bin
     69        set pg_version          82
    3570}