# -*- 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                portsentry
version             1.2
categories          security
license             CPL-1
maintainers         nomaintainer
description         port scan detection and active defense
long_description    PortSentry is part of the Abacus Project suite of \
                    security tools.  \
                    It is a program designed to detect and respond to port \
                    scans against  \
                    a target host in real-time. There are other port scan \
                    detectors that  \
                    perform similar detection of scans, but PortSentry has \
                    some unique  \
                    features that may make it worth looking into.
homepage            https://sourceforge.net/projects/sentrytools/
master_sites        https://dl.packetstormsecurity.net/UNIX/IDS/ \
                    sourceforge:sentrytools
platforms           darwin

worksrcdir          ${name}_beta

checksums           rmd160  8bf4bce18229a7ebff47e7fe50493738ae818085 \
                    sha256  dd1edcfcf2d9db7b5722de4f1da36ae45703bf05917af657ab6f7491be7fa52e \
                    size    48054

use_configure       no
build.target        generic

patchfiles          patch-portsentry.c.diff

post-patch {
    reinplace "s|/usr/local/psionic/portsentry/portsentry.conf|${prefix}/etc/${name}/portsentry.conf|" \
        ${worksrcpath}/portsentry_config.h
    
    reinplace "s|/usr/local/psionic/portsentry|${prefix}/etc/${name}|g" \
        ${worksrcpath}/portsentry.conf
}

destroot {
    file mkdir ${destroot}${prefix}/etc/${name}
    file mkdir ${destroot}${prefix}/share/doc/${name}

    foreach doc_file {README.install README.methods README.stealth} {
        system "install -m 644 ${worksrcpath}/$doc_file ${destroot}${prefix}/share/doc/${name}"
    }

    foreach file {portsentry.conf portsentry.ignore} {
        system "install -m 644 ${worksrcpath}/$file ${destroot}${prefix}/etc/${name}"
    }

    system "install -m 755 ${worksrcpath}/portsentry ${destroot}${prefix}/libexec/"
}

livecheck.distname  ${name}