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

PortSystem              1.0

name                    nikto
version                 2.1.4
categories              www security
platforms               darwin
supported_archs         noarch
license                 GPL-2
maintainers             strasweb.fr:rudloff \
                        openmaintainer
homepage                http://cirt.net/nikto2
description             Web server scanner
long_description        Nikto is an Open Source (GPL) web server scanner \
                        which performs comprehensive tests against web \
                        servers for multiple items, including over 6400 \
                        potentially dangerous files/CGIs, checks for \
                        outdated versions of over 1200 servers, and version \
                        specific problems on over 270 servers. It also \
                        checks for server configuration items such as the \
                        presence of multiple index files, HTTP server \
                        options, and will attempt to identify installed web \
                        servers and software. Scan items and plugins are \
                        frequently updated and can be automatically updated.
master_sites            https://cirt.net/nikto/
checksums               sha1    414e2923131bbe2091cf8107998b3519c2120fff \
                        rmd160  d58b488f9a3c6fc37b5e745e29c1288a4db09e98
depends_run             port:perl5

patchfiles              patch-nikto.conf.diff

use_configure           no

build {
    reinplace "s|/etc/nikto.conf|${prefix}/etc/nikto/nikto.conf|g" ${worksrcpath}/nikto.pl
    reinplace "s|#!/usr/bin/perl|#!${prefix}/bin/perl|" ${worksrcpath}/nikto.pl
    reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/nikto.conf
}

destroot {
    xinstall -d ${destroot}${prefix}/etc/nikto
    xinstall -d ${destroot}${prefix}/share/nikto
    copy ${worksrcpath}/plugins ${destroot}${prefix}/share/${name}/plugins
    copy ${worksrcpath}/templates ${destroot}${prefix}/share/${name}/templates
    copy ${worksrcpath}/docs ${destroot}${prefix}/share/${name}/docs
    xinstall ${worksrcpath}/nikto.pl ${destroot}${prefix}/bin/nikto
    xinstall -m 644 ${worksrcpath}/nikto.conf ${destroot}${prefix}/etc/nikto/nikto.conf.sample
}

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