# -*- 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
PortGroup               github 1.0

github.setup            sullo nikto 2.5.0
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from     tarball
categories              www security
platforms               any
supported_archs         noarch
license                 GPL-2
maintainers             {i0ntempest @i0ntempest} 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.

checksums               rmd160  6f36a161fe9bf7bfbb267dba38629eb008ba977f \
                        sha256  fb1b470879fb958adf9a53d013b47eba827a366f62715b7a3e44df058d36f4bc \
                        size    435932

depends_run             port:perl5

patchfiles              patch-nikto.conf.diff

use_configure           no
build.dir               ${worksrcpath}/program

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

destroot {
    xinstall -d ${destroot}${prefix}/etc/nikto
    xinstall -d ${destroot}${prefix}/share/nikto
    copy ${build.dir}/plugins ${destroot}${prefix}/share/${name}/plugins
    copy ${build.dir}/databases ${destroot}${prefix}/share/${name}/databases
    copy ${build.dir}/templates ${destroot}${prefix}/share/${name}/templates
    copy ${build.dir}/docs ${destroot}${prefix}/share/${name}/docs
    xinstall ${build.dir}/nikto.pl ${destroot}${prefix}/bin/nikto
    xinstall -m 644 ${build.dir}/nikto.conf.default ${destroot}${prefix}/etc/nikto
}

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