PortSystem 1.0

name            quagga
version         0.99.16
revision        2
categories      net
license         GPL-2+
platforms       darwin
maintainers     nomaintainer
description     Collection of Routing daemons for OSPF BGP and RIP
long_description    Quagga is a routing software suite, providing implementations \
                of OSPFv2, OSPFv3, RIP v1 and v2, RIPng and BGP-4 for Unix \
                platforms, particularly FreeBSD, Linux, Solaris and NetBSD. \
                Quagga is a fork of GNU Zebra which was developed by Kunihiro \
                Ishiguro. The Quagga tree aims to build a more involved community \
                around Quagga than the current centralised model of GNU Zebra. \
                This port installs the binaries, but does not include startup \
                items, it should be considered experimental.

homepage        http://www.quagga.net/
master_sites    savannah

checksums       md5     350fb150be526cdfc4d2b093cb4d69a7 \
                sha1    2ba554a41671988257e51cf1cb5cb25015fb942f \
                rmd160  c4930bc2ef23b469e8d56f25c97edacff292b93a

patchfiles      quagga-patch1.diff \
                quagga-patch2.diff \
                quagga-patch3.diff \
                rfc3542.diff

depends_build   port:gawk
depends_lib     port:readline

configure.args  --localstatedir=${prefix}/var/run/quagga \
                --sysconfdir=${prefix}/etc/quagga \
                --mandir=${prefix}/share/man \
                --enable-vty-group=staff

add_users       quagga group=quagga realname=Quagga home=${prefix}/var/quagga

post-destroot {
    xinstall -o quagga -g quagga -m 755 -d \
        ${destroot}${prefix}/var/run/quagga ${destroot}${prefix}/etc/quagga \
        ${destroot}${prefix}/var/quagga/logs
}

post-activate {
    # Make sure initial conf files are present and setup correctly
    foreach f { bgpd.conf ospf6d.conf ospfd.conf ripd.conf ripngd.conf zebra.conf } {
        if {![file exists ${prefix}/etc/quagga/${f}]} {
            file copy ${prefix}/etc/quagga/${f}.sample \
                ${prefix}/etc/quagga/${f}
        }
    }

    ui_msg "******************************************************"
    ui_msg "* The routing protocol daemons are in ${prefix}/sbin"
    ui_msg "* bgpd ospfd ospf6d ripd ripng isisd zebra"
    ui_msg "* These have not been well tested on Mac OS X (yet)"
    ui_msg "* The man files for the above are in section 8"
    ui_msg "* The sample configs in ${prefix}/etc/quagga"
    ui_msg "* sudo cp <daemon>.conf.sample <daemon>.conf"
    ui_msg "* and edit as needed."
    ui_msg "* No Startup Items have been made (yet)"
    ui_msg "* As an example to start one of the daemons use"
    ui_msg "* sudo ospfd -d"
    ui_msg "* These drop root privileges and run as quagga/quagga"
    ui_msg "* To manage these daemons use"
    ui_msg "* telnet localhost:2604"
    ui_msg "* For more info see http://quagga.net/about.php"
    ui_msg "* To stop one of the daemons use e.g."
    ui_msg "* sudo kill `cat ${prefix}/var/run/quagga/ospfd.pid`"
    ui_msg "******************************************************"
}

destroot.keepdirs   ${destroot}${prefix}/var/run/quagga \
                    ${destroot}${prefix}/var/quagga/logs