# $Id: Portfile,v 1.1 2006/05/23 06:19:03 markd Exp $
PortSystem      1.0

name                    moomps
version                 5.6
categories              net
maintainers             markd@opendarwin.org

description             Modular Object Oriented Multi-Purpose Service - A monitoring daemon \
			that uses configuration files created by moodss.

long_description        Moomps is a monitoring daemon which works using configuration \
			files created by the moodss (Modular Object Oriented Dynamic \
			SpreadSheet) graphical application. The configuration files \
			contain the definition of thresholds, which when crossed, \
			create messages in the system log, and can trigger the email \
			alert messages or the execution of user defined scripts.

homepage                http://moodss.sourceforge.net/
platforms               darwin
master_sites            sourceforge:moodss
checksums               md5 f2cf3e281df6e004889672dc11b1d505
use_bzip2		yes

patchfiles		patch-Makefile \
			patch-moomps.sh

depends_lib             port:moodss \
			port:tclx

        startupitem.create      yes
        startupitem.name        moomps
        startupitem.start       "${prefix}/share/moomps/moomps start"
        startupitem.stop        "${prefix}/share/moomps/moomps stop"

variant	sqlite3 {
	depends_lib-append	port:sqlite3
}

variant mysqltcl {
        depends_lib-append      port:mysqltcl
}

use_configure		no

set moompsdir ${prefix}/share/moomps

post-patch {
# Set install paths for DarwinPorts
        reinplace "s|__DESTROOT__|${destroot}|g" \
                "${worksrcpath}/Makefile"

        reinplace "s|__PREFIX__|${prefix}|g" \
                ${worksrcpath}/Makefile \
		${worksrcpath}/moomps.sh
}

pre-build {
        adduser moomps
        addgroup moomps
}

post-destroot {
	xinstall -m 755 -d ${destroot}${prefix}/share/moomps/moofiles
        xinstall -m 755 -d ${destroot}${prefix}/var/lock
        xinstall -m 755 -d ${destroot}${prefix}/var/run

        destroot.keepdirs \
		${destroot}${prefix}/share/moomps/moofiles \
                ${destroot}${prefix}/var/lock \
		${destroot}${prefix}/var/run
}

post-activate {
ui_msg "\n
You must place your moodss files (.moo) in the following path:

	${prefix}/share/moomps/moofiles

for the moomps daemon to find them.
\n"
}
