# $Id: Portfile 117304 2014-02-21 16:47:01Z raimue@macports.org $

PortSystem 1.0
PortGroup github 1.0

github.setup        raimue molly-guard 0.4.5 macports/
categories          sysutils
platforms           darwin
supported_archs     noarch
license             Artistic-2
maintainers         raimue
description         Avoid accidental shutdowns or reboots
long_description \
    This ports overrides the existing shutdown, reboot, halt commands with \
    its own version that first executes some checks before invoking the real \
    system functionality. For example, one script shipped with this port \
    checks for existing SSH sessions. If any of the three commands are called \
    interactively over an SSH session, the shell script prompts you to enter \
    the name of the host you wish to shut down. This should adequately \
    prevent you from accidental shutdowns and reboots.

checksums           rmd160  082d2f4b02ceefa51a3303ec29715b41eb7acb53 \
                    sha256  4a5af40677cb3784023a3f2e4d307aa9821d775677943c1823a6fd167f64a0c6

depends_build       port:libxslt \
                    port:docbook-xsl
depends_run         port:debianutils

use_configure       no
build.args          prefix=${prefix}
destroot.args       prefix=${prefix}
destroot.destdir    DEST=${destroot}

post-destroot {
    move ${destroot}${prefix}/etc/molly-guard/rc ${destroot}${prefix}/etc/molly-guard/rc.default
}

post-activate {
    if {![file exists ${prefix}/etc/molly-guard/rc]} {
        file copy ${prefix}/etc/molly-guard/rc.default ${prefix}/etc/molly-guard/rc
    }
}
