# -*- 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                rkhunter
version             1.4.6
revision            1
categories          sysutils security
license             GPL-2
maintainers         {mps @Schamschula} openmaintainer
description         A tool to search for rootkits.
long_description    ${description}
platforms           darwin
homepage            http://rkhunter.sourceforge.net/
master_sites        sourceforge:project/rkhunter/rkhunter/${version}/

checksums           rmd160  545a847f74a34151fda2ca8eadc135d0528355c6 \
                    sha256  f750aa3e22f839b637a073647510d7aa3adf7496e21f3c875b7a368c71d37487

# stealth update
dist_subdir         rkhunter/${version}_${revision}

depends_lib         port:wget

patchfiles          patch-installer.sh.diff

post-patch {
	reinplace -W ${worksrcpath}/files "s|/var/log/rkhunter.log|${prefix}/var/log/rkhunter/rkhunter.log|g" rkhunter.conf
}

use_configure       no

build               {}

destroot.cmd        ./installer.sh
destroot.args       --layout custom ${prefix} --install
destroot.keepdirs   ${destroot}${prefix}/var/log/rkhunter
destroot.target

post-destroot {
	xinstall ${filespath}/rkhunter.conf.local.sample ${destroot}${prefix}/etc/rkhunter
	reinplace -W ${destroot}${prefix}/etc/rkhunter "s|@PREFIX@|${prefix}|g" rkhunter.conf.local.sample
	xinstall -m 755 -d ${destroot}${prefix}/var/log/rkhunter
}

notes "
Set up a local configuration file. You may start with the sample file

sudo cp ${prefix}/etc/rkhunter/rkhunter.conf.local.sample ${prefix}/etc/rkhunter/rkhunter.conf.local

and then edit it as needed.
"
