# -*- 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

PortSystem          1.0

name                oinkmaster
version             2.0
categories          net
platforms           darwin
maintainers         {mps @Schamschula} openmaintainer
license             BSD
supported_archs     noarch

description         Oinkmaster is a script that will help you update and manage your \
                    Snort rules.

long_description    ${description}

homepage            http://oinkmaster.sourceforge.net/
master_sites        sourceforge:project/oinkmaster/oinkmaster/${version}/

checksums           rmd160  a3292cfc2e6b175008a7172be5809ca6e2fc85b7 \
                    sha256  3d52f0426aa7c81b122cef22b80d708d8bb8337537e48754a065804f46c46162

depends_run         port:wget

patchfiles          patch-oinkmaster.1.diff \
                    patch-oinkmaster.conf.diff \
                    patch-oinkmaster.pl.diff

post-patch {
    reinplace -W ${worksrcpath} "s|@PREFIX@|${prefix}|g" \
                    oinkmaster.1 \
                    oinkmaster.conf \
                    oinkmaster.pl
}

use_configure       no

build               {}

destroot {
    xinstall -m 755 ${worksrcpath}/oinkmaster.pl ${destroot}${prefix}/bin
    xinstall -m 755 ${worksrcpath}/oinkmaster.conf ${destroot}${prefix}/etc/oinkmaster.conf.sample
    xinstall -m 755 ${worksrcpath}/oinkmaster.1 ${destroot}${prefix}/share/man/man1

    set docdir ${prefix}/share/doc/${subport}
    xinstall -d ${destroot}${docdir}
    xinstall -m 644 -W ${worksrcpath} \
        ChangeLog \
        FAQ \
        LICENSE \
        README \
        README.templates \
        ${destroot}${docdir}
}

post-activate {
    if {![file exists ${prefix}/etc/oinkmaster.conf]} {
        copy ${prefix}/etc/oinkmaster.conf.sample ${prefix}/etc/oinkmaster.conf
    }
}