# -*- 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                jailkit
version             2.23
categories          security sysutils
license             BSD
maintainers         nomaintainer
description         utilities to create limited user accounts in a chroot jail
long_description    Jailkit is a set of utilities to allow quick creation of \
                    limited user accounts in a chroot jail. It contains a safe \
                    logging daemon, shells that can restrict users, utilities \
                    to start daemons in a chroot jail, and utilities for easy \
                    setup of chroot jails.

homepage            https://olivier.sessink.nl/jailkit/
master_sites        ${homepage}

checksums           rmd160  3dc456a9c8d5f11201d482e4ea9d6e929d37aadd \
                    sha256  490bbc2b955f0f03dc56789decd828287321b8ec234123cecf2fdf2aacce3f5a \
                    size    141715

patchfiles          patch-Makefile.in.diff

depends_lib         port:python312

configure.env       PYTHONINTERPRETER=${prefix}/bin/python3.12

destroot.keepdirs   ${destroot}${prefix}/etc/jailkit

post-destroot {
    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 -W ${worksrcpath} COPYRIGHT INSTALL.txt README.txt \
        ${destroot}${prefix}/share/doc/${name}
    move {*}[glob ${destroot}${prefix}/etc/jailkit/*] \
        ${destroot}${prefix}/share/doc/${name}
}

post-activate {
    foreach {c} {check chrootsh init lsh socketd uchroot update} {
        set conf ${prefix}/etc/jailkit/jk_${c}.ini
        if {![file exists ${conf}]} {
            copy ${prefix}/share/doc/${name}/jk_${c}.ini ${conf}
        }
    }
}