# $Id: Portfile 50984 2009-05-14 21:08:43Z and.damore@macports.org $
PortSystem        1.0
name              logsentry
version           1.1.1
distname          logcheck-${version}
categories        security
maintainers       touche.fr.st:julien.touche
description       logfile auditing tool
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
configure { }
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"
}
