# $Id: Portfile,v 1.4 2006/03/25 01:22:18 markd Exp $

PortSystem	1.0

name				rancid
version				2.3.1

categories			net
maintainers			markd@opendarwin.org
platforms			darwin

description			Really Awesome New Cisco confIg Differ

long_description	        Rancid maintains a CVS repository of router and \
				device config files.  It emails you when changes \
				occur and tells you what commands were changed.

homepage			http://www.shrubbery.net/rancid
					
master_sites		        ftp://ftp.shrubbery.net/pub/rancid/

checksums			md5 b188595e528515b4f87078f63936d355

depends_lib                     port:openssl

# RANCID needs at least expect version 5.40 and only darwin 8 meets the requirement
platform darwin 7 {
		depends_lib-append port:expect
}

platform darwin 6 {
                depends_lib-append port:expect
}

pre-configure {
 		reinplace "s|@bindir@|${destroot}@bindir@|g" \
        ${worksrcpath}/Makefile.in ${worksrcpath}/bin/Makefile.in

                reinplace "s|@sysconfdir@|${destroot}@sysconfdir@|g" \
        ${worksrcpath}/Makefile.in ${worksrcpath}/etc/Makefile.in

                reinplace "s|@localstatedir@|${destroot}@localstatedir@|g" \
        ${worksrcpath}/Makefile.in
}

configure.args			--localstatedir=${prefix}/var/${name} \
				--bindir=${prefix}/libexec/${name} \
				--sysconfdir=${prefix}/etc/${name} \
				--mandir=\\\${prefix}/share/man

destroot.destdir                prefix=${destroot}${prefix}
post-destroot {
		xinstall -d 755  ${destroot}${prefix}/bin
		system "ln -s -f ${prefix}/libexec/${name}/rancid-cvs ${destroot}${prefix}/bin/rancid-cvs"
	        system "ln -s -f ${prefix}/libexec/${name}/rancid-run ${destroot}${prefix}/bin/rancid-run"        
}

post-activate {

		ui_msg "\nCopy the sample .cloginrc file to the RANCID user's home directory,
make sure it isn't world readable, and edit it according to your needs.

cp ${prefix}/share/rancid/cloginrc.sample ~/.cloginrc
sudo chmod 640 ~/.cloginrc

See the README file in ${prefix}/share/rancid for instructions.\n"
}
