PortSystem      1.0

name                    moodss
version                 21.5
revision                1
categories              net
maintainers             nomaintainer

description             Modular Object Oriented Dynamic Spreadsheet - A graphical \
			monitoring application that supports external modules \
			including Nagios plugins.  It supports SNMP when used with \
			the Scotty Tcl extensions package.

long_description        ${description}
homepage                http://moodss.sourceforge.net/
platforms               darwin
master_sites            sourceforge
checksums               md5 4d05f8135c05d7f39dd0a8868c899897
use_bzip2		yes

depends_lib             port:tcl \
			port:tk \
			port:tktable \
			port:blt \
			port:scotty \
			port:sqlite3

patchfiles		patch-Makefile

variant nagios_plugins {
	depends_lib-append      port:nagios-plugins
}

variant mysqltcl {
        depends_lib-append      port:mysqltcl
}

variant rproject {
        depends_lib-append      port:R
}

use_configure	no
build {}

post-patch {
# Set the location of the moomps resource file to where the moomps port puts it
#        reinplace "s|/etc/moomps/rc|${prefix}/etc/moomps/rc|g" \
#                "${worksrcpath}/global.tcl"

#   When Nagios plugin path is set, '/<plugin_path>/check_' may be ommitted from Nagios check commands
	reinplace "s|/usr/lib/nagios/plugins/|${prefix}/libexec/nagios/|g" \
                "${worksrcpath}/nagios/nagios.tcl"
}

destroot.args-append    ROOTDIR=${destroot} \
                        TCLLIBDIR=${prefix}/lib \
                        BINDIR=${prefix}/bin \
                        LIBDIR=${prefix}/lib \
                        MANDIR=${prefix}/share/man \
                        DOCDIR=${prefix}/share/doc \
                        MOODSSLIBDIR=${prefix}/lib/moodss \
                        MOOMPSRCFILE=${prefix}/etc/moomps/rc

post-activate {
# User Instructions

ui_msg "\n
To enable the moodss ping module you must activate the ${prefix}/bin/nmicmpd
daemon (a component of the dependent package Scotty).  To do this:

   1) Edit the /etc/services file as described in ${prefix}/lib/moodss/ping/INSTALL.

   2) OS X 10.4 (see below for 10.3) - Load the nmicmpd LaunchD script installed by MacPorts' Scotty dependency.
        sudo launchctl load -w /Library/LaunchDaemons/org.macports.nmicmpd.plist

   3) Reboot and test the nmicmpd daemon:
        telnet localhost nmicmp
        ps -ax |grep nmicmpd (The daemon loads only when requested and unloads afterwards)

      Or you may test the ping module within moodss:
	moodss ping

   Additional instructions for OS X 10.3:
    a) A startup item was created in /Library/StartupItems
        Add \"NMICMPD=-YES-\" to the /etc/hostconfig file to run nmicmpd at system boot.

    b) Add an xinetd entry for nmicmp as described in ${prefix}/lib/moodss/ping/INSTALL.

    c) Reboot and test as shown in step 3 above.

\n"
}