# $Id$

PortSystem		1.0

name			radmind
version			1.11.1
revision        2
categories		net sysutils
license			BSD
maintainers		nomaintainer
description		Remotely administer the file systems of multiple unix machines
long_description	A suite of Unix command-line tools and a server \
					designed to remotely administer the file systems of \
					multiple Unix machines. At its core, radmind \
					operates as a tripwire. It is able to detect changes \
					to any managed filesystem object, e.g. files, \
					directories, links, etc.  However, radmind goes \
					further than just integrity checking: once a change \
					is detected, radmind can optionally reverse the \
					change.
platforms		darwin
homepage		http://rsug.itd.umich.edu/software/radmind
master_sites	sourceforge
checksums		md5 62419551c6b83873f10b5eb4462cd007

depends_lib		path:lib/libssl.dylib:openssl port:zlib

configure.args	--mandir='\${prefix}/share/man' \
				--with-radminddir='\${prefix}/var/radmind'

destroot.keepdirs	${destroot}${prefix}/var/radmind/cert \
					${destroot}${prefix}/var/radmind/client \
					${destroot}${prefix}/var/radmind/command \
					${destroot}${prefix}/var/radmind/file \
					${destroot}${prefix}/var/radmind/preapply \
					${destroot}${prefix}/var/radmind/postapply \
					${destroot}${prefix}/var/radmind/special \
					${destroot}${prefix}/var/radmind/tmp/file \
					${destroot}${prefix}/var/radmind/tmp/transcript \
					${destroot}${prefix}/var/radmind/transcript
post-destroot {
	xinstall -d -m 0755 ${destroot}${prefix}/share/doc/${name}
	xinstall -m 0644 -W ${worksrcpath} COPYRIGHT README SPEC \
		${destroot}${prefix}/share/doc/${name}

	xinstall -d -m 0750 ${destroot}${prefix}/var/radmind/cert
	xinstall -d -m 0755 ${destroot}${prefix}/var/radmind/client
	xinstall -d -m 0750 ${destroot}${prefix}/var/radmind/command
	xinstall -d -m 0750 ${destroot}${prefix}/var/radmind/file
	xinstall -d -m 0750 ${destroot}${prefix}/var/radmind/preapply
	xinstall -d -m 0750 ${destroot}${prefix}/var/radmind/postapply
	xinstall -d -m 0750 ${destroot}${prefix}/var/radmind/special
	xinstall -d -m 0750 ${destroot}${prefix}/var/radmind/tmp
	xinstall -d -m 0750 ${destroot}${prefix}/var/radmind/tmp/file
	xinstall -d -m 0750 ${destroot}${prefix}/var/radmind/tmp/transcript
	xinstall -d -m 0750 ${destroot}${prefix}/var/radmind/transcript

	system "echo 'Place ca.pem & cert.pem files in this directory.' > ${destroot}${prefix}/var/radmind/cert/README"
	system "echo 'Place command files in this directory.' > ${destroot}${prefix}/var/radmind/client/README"

	# radmind start/stop rc script (if non-Darwin)
	if {${os.platform} ne "darwin"} {
		xinstall -d -m 0755 ${destroot}${prefix}/etc/rc.d
		xinstall -m 0755 ${filespath}/radmind.sh.in \
			${destroot}${prefix}/etc/rc.d/radmind.sh
		reinplace "s%__PREFIX%${prefix}%" \
			${destroot}${prefix}/etc/rc.d/radmind.sh
	}
}

platform darwin {
	startupitem.create			yes
	startupitem.name			Radmind
	startupitem.requires		Resolver Disks
	startupitem.start			"if \[ -f ${prefix}/var/radmind/config \]; then"
	startupitem.start-append	"\tCheckForNetwork"
	startupitem.start-append	"\t\[ \"\${NETWORKUP}\" = \"-YES-\" \] && \\"
	startupitem.start-append	"\t\t${prefix}/sbin/radmind -R -u 077"
	startupitem.start-append	"fi"
	startupitem.stop			"/usr/bin/killall radmind"
}

livecheck.regex		<title>${name} ${name}-(.*) released.*</title>