# -*- 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                logsentry
version             1.1.1
distname            logcheck-${version}
categories          security
license             GPL-2
maintainers         nomaintainer
description         logfile auditing tool (previously logcheck)
long_description \
    Logsentry is a scheduled auditing tool that scans system log files \
    for security violations and unusual activity. Reports of suspicious \
    log entries are mailed to a specified user (usually root). \
    \
    Logsentry was formerly known as logcheck.

homepage            http://sourceforge.net/projects/sentrytools
master_sites        sourceforge:sentrytools

platforms           darwin
checksums           md5 e97c2f096e219e20310c1b80e9e1bc29

use_configure       no
build.target        build

patchfiles          patch-Makefile
destroot.target     install

post-patch {
    reinplace "s|^TMPDIR = /usr/local/etc/tmp|TMPDIR = ${prefix}/var/tmp|" ${worksrcpath}/Makefile
}

destroot {
    file mkdir ${destroot}${prefix}/etc/${name}
    file mkdir ${destroot}${prefix}/share/doc/${name}
    foreach doc_file {
        CREDITS INSTALL README README.how.to.interpret README.keywords
    } { system "install -m 644 ${worksrcpath}/$doc_file ${destroot}${prefix}/share/doc/${name}" }
    foreach file {
        logcheck.violations logcheck.violations.ignore \
        logcheck.ignore logcheck.hacking
    } { system "install -m 644 ${worksrcpath}/systems/generic/$file ${destroot}${prefix}/etc/${name}" }
    system "install -m 755 ${worksrcpath}/src/logtail ${destroot}${prefix}/bin/"
    system "install -m 755 ${worksrcpath}/systems/generic/logcheck.sh ${destroot}${prefix}/bin/"
}

post-destroot {
    file mkdir ${destroot}${prefix}/var/tmp
    system "touch ${destroot}${prefix}/var/tmp/.turd"
    system "chmod 700 ${destroot}${prefix}/var/tmp"
}