# $Id: Portfile,v 1.6 2004/06/12 12:20:52 mww Exp $

PortSystem 1.0

name		throttled
version		0.3.2
categories	net
maintainers	mww@opendarwin.org
description	network bandwidth throttle daemon
platforms	darwin freebsd
long_description	throttled is a bandwidth throttle daemon for Mac OS X, \
			FreeBSD, and Linux which allows you to put a cap on \
			your upstream bandwidth and keep your download speeds \
			high even when your server is sending out at full speed.

homepage	http://www.intrarts.com/throttled.html
master_sites	http://www.intrarts.com/Files/
extract.suffix	.tgz
patchfiles	patch-throttled-startup.diff

checksums	md5 d3e48c06ed3c8a4bf0017a37c213f4cb

depends_run	path:/Library/StartupItems/DarwinPortsStartup:DarwinPortsStartup

post-extract	{
	file copy ${filespath}/throttled.sh ${worksrcpath}
}

configure	{
	reinplace "s|__PREFIX__|${prefix}|g" ${worksrcpath}/throttled-startup \
		${worksrcpath}/throttled.sh
}

build.target
build.dir	${worksrcpath}/src

destroot	{
	xinstall -m 755 -d ${destroot}${prefix}/etc/rc.d \
		${destroot}${prefix}/share/doc/${name}
	xinstall -m 755 -s ${worksrcpath}/src/throttled ${destroot}${prefix}/sbin
	xinstall -m 644 ${worksrcpath}/throttled.sh ${destroot}${prefix}/etc/rc.d/
	xinstall -m 644 ${worksrcpath}/throttled-startup \
		${destroot}${prefix}/etc/throttled.conf.sample
	xinstall -m 644 -W ${worksrcpath} README.txt COPYING.txt \
		${destroot}${prefix}/share/doc/${name}
}
