# $Id: Portfile,v 1.6 2005/08/11 21:33:23 rshaw Exp $
PortSystem		1.0

name			fping
version			2.4b2_to
categories		net
maintainers		darwinports@opendarwin.org
platforms		darwin
homepage		http://www.fping.com
master_sites	${homepage}/download/
checksums   	md5 d5e8be59e307cef76bc479e1684df705
description		A scriptable ping program to check if multiple hosts are up
long_description	fping is different from ping in that you can specify \
					any number of hosts on the command line, or specify \
					a file containing the lists of hosts to ping. \
					Instead of trying one host until it timeouts or \
					replies, fping will send out a ping packet and move \
					on to the next host in a round-robin fashion. If a \
					host replies, it is noted and removed from the list \
					of hosts to check. If a host does not respond within \
					a certain time limit and/or retry limit it will be \
					considered unreachable. 

configure.args	--mandir="${prefix}/share/man"

post-destroot {
	if {[variant_isset ipv6]} {
		system "ln -s fping.8 ${destroot}${prefix}/share/man/man8/fping6.8"
	}
	# Check if user is running as root
	if {$env(USER) == "root"} {
		system "chmod 4511 ${destroot}${prefix}/sbin/fping"
		if {[variant_isset ipv6]} {
			system "chmod 4511 ${destroot}${prefix}/sbin/fping6"
		}
	} else {
		ui_msg "-----------------------------------------------------------"
		ui_msg "Note that you are not running as root, so ${name} cannot"
		ui_msg "be installed setuid root. Therefore, it will only be able"
		ui_msg "to be executed by root."
		ui_msg "-----------------------------------------------------------"
		system "chmod 0511 ${destroot}${prefix}/sbin/fping"
		if {[variant_isset ipv6]} {
			system "chmod 0511 ${destroot}${prefix}/sbin/fping6"
		}
	}
}

variant ipv6 {
	version			2.4b2_to-ipv6
	checksums  		md5 b1f10f88afd35b94846bfb0844d7a834
	master_sites	http://unfix.org/projects/ipv6/
}

