# -*- 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        offensive-security exploitdb 2022-10-18
github.tarball_from archive
revision            0

categories          security
supported_archs     noarch
platforms           any
license             GPL-2
maintainers         {judaew @judaew} openmaintainer

description         Offensive Security’s Exploit Database Archive
long_description    {*}${description}
homepage            https://www.exploit-db.com

checksums           rmd160  021295443c03876cff6e3688ac756f1ca24fbec0 \
                    sha256  7f83aaea52ce759ed1a0b1e5e63880625d25b8879f63ab9a309ffb9652b1e1cd \
                    size    43225790

depends_run         port:bash

patchfiles          patch-fix-prefix-in-rcfile.diff

post-patch {
    reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/.searchsploit_rc
    reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/searchsploit
}

use_configure       no
build               {}

destroot {
    xinstall -m 0755 ${worksrcpath}/searchsploit ${destroot}${prefix}/bin
    xinstall -m 0644 ${worksrcpath}/.searchsploit_rc \
        ${destroot}${prefix}/etc/searchsploit.rc

    xinstall -d ${destroot}${prefix}/share/${name}
    move ${worksrcpath}/exploits \
        ${worksrcpath}/shellcodes \
        ${destroot}${prefix}/share/${name}
    xinstall -m 0644 {*}[glob ${worksrcpath}/files_*.csv] \
        ${destroot}${prefix}/share/${name}

}