# $Id: Portfile,v 1.16 2006/06/20 05:06:17 yeled Exp $
PortSystem 1.0
name		ddclient
version		3.6.7
platforms	darwin
categories	net
maintainers	yeled@opendarwin.org
description	Update dynamic DNS entries
long_description	ddclient is a Perl client used to update dynamic \
			DNS entries for accounts on many dynamic DNS services.
homepage	http://ddclient.sourceforge.net/
master_sites	sourceforge:ddclient
checksums	md5 11ab25abe2f1094f18f9d071c51c03a4
depends_run	bin:perl:perl5.8

configure	{
		reinplace "s|\[\r\]$||" ${worksrcpath}/${portname}
		reinplace "s|^#!.*/perl.*$|#!${prefix}/bin/perl|" ${worksrcpath}/${portname}
		reinplace "s|/etc/|${prefix}/etc/|" ${worksrcpath}/${portname}
}

build	{}

pre-destroot {
		file mkdir ${destroot}${prefix}/etc/ddclient
}

destroot	{
		xinstall -m 555 ${worksrcpath}/sample-etc_ddclient.conf \
			${destroot}${prefix}/etc/ddclient/ddclient.conf.sample

		reinplace "s|/var/run|${prefix}/var/run|" \
			${destroot}${prefix}/etc/ddclient/ddclient.conf.sample

		xinstall -m 555 ${worksrcpath}/${portname} ${destroot}${prefix}/sbin
		xinstall -d ${destroot}${prefix}/share/doc/${portname}

		eval file copy [glob ${worksrcpath}/sample-*] \
			${destroot}${prefix}/share/doc/${portname}
		eval file copy [glob ${worksrcpath}/COPY*] \
			${destroot}${prefix}/share/doc/${portname}
		eval file copy [glob ${worksrcpath}/README*] \
			${destroot}${prefix}/share/doc/${portname}

		destroot.keepdirs ${destroot}${prefix}/var/run
}

startupitem.create      yes
startupitem.start       ${prefix}/sbin/ddclient
startupitem.stop        "/bin/kill \$(cat ${prefix}/var/run/ddclient.pid)"


