# $Id$

PortSystem      1.0

name                    moomps
version                 5.8
categories              net
maintainers             nomaintainer

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 24f49a6df9c0701d23f99d62b030d72b
use_bzip2		yes

patchfiles		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
build {}

pre-build {
        adduser moomps
        addgroup moomps
}

destroot {
	system "make \
			ROOTDIR=${destroot} \
			TCLSH=${prefix}/bin/tclsh \
			SBINDIR=${prefix}/sbin \
			LIBDIR=${prefix}/lib \
			MANDIR=${prefix}/share/man \
			DOCDIR=${prefix}/share/doc \
			MOODSSLIBDIR=${prefix}/lib/moodss \
			ETCDIR=${prefix}/etc \
			DATADIR=${prefix}/share/moomps/moofiles \
			INITDIR=${prefix}/share/moomps \
			MANDIR=${prefix}/share/man \
			DOCDIR=${prefix}/share/doc \
			MOOMPSRCFILE=${prefix}/etc/moomps/rc \
		install"
}

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 this path:

	${prefix}/share/moomps/moofiles

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