# -*- 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            autopsy
license         GPL-2
version         2.24
revision        1
categories      sysutils
maintainers     nomaintainer
platforms       darwin
description     Autopsy Forensic Browser
long_description \
    The Autopsy Forensic Browser is a graphical interface to the \
    command line digital investigation analysis tools in  The Sleuth \
    Kit. Together, they can analyze Windows and UNIX disks and file \
    systems (NTFS, FAT, UFS1/2, Ext2/3). \
    The Sleuth Kit and Autopsy are both Open Source and run on UNIX \
    platforms. As Autopsy is HTML-based, you can connect to the \
    Autopsy server from any platform using an HTML browser. Autopsy \
    provides a \"File Manager\"-like interface and shows details about \
    deleted data and file system structures.

homepage        http://www.sleuthkit.org/autopsy/
master_sites    sourceforge:project/autopsy/autopsy/${version}

checksums       sha256  ab787f519942783d43a561d12be0554587f11f22bc55ab79d34d8da703edc09e \
                rmd160  de85770e21f1c65c938015c0dde2133136e02b60

patchfiles      patch-configure-no-interactivity.diff

use_configure   no

depends_build   port:file \
                path:bin/perl:perl5 \
                port:sleuthkit \
                port:md5sha1sum

set evidence_locker "${prefix}/var/lib/${name}"
post-patch {
    reinplace "s|^dirs='.*'$|dirs='${prefix}/bin/ /usr/bin/ /sbin/'|g"  \
        ${worksrcpath}/configure
    reinplace "s|\\\$PWD/|${prefix}/share/${name}/|g" ${worksrcpath}/configure
    reinplace "s|MP_AUTOPSY_LOCKER|${evidence_locker}/|g" ${worksrcpath}/configure
}

destroot {
    xinstall -m 755 -d ${destroot}${evidence_locker}

    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}

    xinstall -m 755 -d ${destroot}${prefix}/share/${name}
    xinstall -m 755 -d ${destroot}${prefix}/share/${name}/help
    xinstall -m 755 -d ${destroot}${prefix}/share/${name}/lib
    xinstall -m 755 -d ${destroot}${prefix}/share/${name}/pict

    xinstall -m 755 -d ${destroot}${prefix}/man/man1

    xinstall -m 644 {*}[glob ${worksrcpath}/docs/*] \
        ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 -W ${worksrcpath} CHANGES.txt INSTALL.txt README.txt \
        ${destroot}${prefix}/share/doc/${name}

    xinstall -m 755 -W ${worksrcpath} autopsy \
        ${destroot}${prefix}/bin

    xinstall -m 644 -W ${worksrcpath} conf.pl global.css \
        ${destroot}${prefix}/share/${name}
    xinstall -m 644 {*}[glob ${worksrcpath}/help/*] \
        ${destroot}${prefix}/share/${name}/help
    xinstall -m 644 {*}[glob ${worksrcpath}/lib/*] \
        ${destroot}${prefix}/share/${name}/lib
    xinstall -m 644 {*}[glob ${worksrcpath}/pict/*] \
        ${destroot}${prefix}/share/${name}/pict

    xinstall -m 644 {*}[glob ${worksrcpath}/man/man1/*] \
        ${destroot}${prefix}/share/man/man1/

}

destroot.keepdirs   ${evidence_locker}

livecheck.regex     "/autopsy/(2\.\[a-zA-Z0-9.\]+)/"
