# $Id: Portfile 129587 2014-12-16 07:32:26Z jmr@macports.org $

PortSystem	1.0

name				mrtg-ping-probe  
version				2.2.0
revision			1

categories			net
license				GPL-2
maintainers			jberry openmaintainer
platforms			darwin
supported_archs		noarch

description			A ping probe adapter for mrtg
long_description	Monitors round trip time and packet loss to another host.
homepage			http://pwo.de/projects/mrtg/
					
master_sites		ftp://ftp.pwo.de/pub/pwo/mrtg/${name}
checksums			md5 5eec5bc5f1c5097248c701d54639d292

depends_lib			bin:mrtg:mrtg

fetch.use_epsv		no
extract.post_args	"| tar -xmf -"

patchfiles			mrtg-ping-probe.patch

use_configure		no

destroot {
	# Ensure needed directories
	xinstall -d ${destroot}${prefix}/share/man
		
	# Install binaries
	xinstall -m 755 \
		${worksrcpath}/mrtg-ping-cfg \
		${worksrcpath}/mrtg-ping-probe \
		${destroot}${prefix}/bin
		
	# Install man pages
	xinstall -m 644 ${worksrcpath}/mrtg-ping-probe.1 \
		${destroot}${prefix}/share/man/man1
	
	# Fixup binaries
	reinplace "s|#!/bin/perl|#!/usr/bin/env perl|" ${destroot}${prefix}/bin/mrtg-ping-probe
	reinplace s|/bin/ksh|/bin/sh| ${destroot}${prefix}/bin/mrtg-ping-cfg
	reinplace s|PING_PROBE=/usr/local/httpd/mrtg|PING_PROBE=${prefix}/bin| ${destroot}${prefix}/bin/mrtg-ping-cfg
}
