# $Id: Portfile,v 1.18 2006/08/08 07:07:54 yeled Exp $
PortSystem 1.0
name        ddclient
version     3.7.0
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 67976f65c2aad267664267bed940ce18
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)"


