# $Id: Portfile,v 1.4 2005/08/24 15:31:04 digdog Exp $

PortSystem 1.0
name		tftp-hpa
version		0.40
categories	net
maintainers	digdog@opendarwin.org
description	Enhanced port of the BSD TFTP server
platforms	darwin freebsd
long_description	tftp-hpa is an enhanced version of the BSD TFTP client \
		and server,  possessing a number of bugfixes and enhancements \
		over the  original. It has been made portable and will work on \
		pretty much any modern Unix variant.

homepage	http://www.kernel.org/pub/software/network/tftp/
master_sites	${homepage}
use_bzip2	yes
checksums	md5 bfcdd49bf94900e610f2cc937d8980ef

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

destroot.destdir	prefix=${destroot}${prefix}

post-destroot	{ 
	file rename ${destroot}${prefix}/sbin/in.tftpd \
		${destroot}${prefix}/sbin/tftpd

	file delete ${destroot}${prefix}/share/man/man8/tftpd.8
	file rename ${destroot}${prefix}/share/man/man8/in.tftpd.8 \
		${destroot}${prefix}/share/man/man8/tftpd.8
}

# Tell the user that the server needs to be used through (x)inetd/launchd
post-install {
        ui_msg "\nTo use tftpd, you'll need to modified settings in inetd.conf/xinetd.d/launchd"
        ui_msg "depending on what you use on your system.\n\n"
        ui_msg "For inetd, something like:"
        ui_msg "tftp  dgram   udp  wait    nobody  ${prefix}/sbin/in.tftd  tftpd /private/tftpboot"
        ui_msg "should do it. And tell inetd to reload its configuration.\n\n"
        ui_msg "For xinetd (the default on Mac OS X 10.3), you should edit file /etc/xinetd.d/tftp\n"
        ui_msg "and change the server setting from /usr/libexec/tftpd into ${prefix}/sbin/in.tftd\n"
        ui_msg "Then, use service(8) command to reload xinetd configuration.\n\n"
        ui_msg "For launchd (the default on Mac OS X 10.4 Tiger), you'll need to change the \n"
        ui_msg "tftp.plist file in /System/Library/LaunchDaemons/. By changing the first string\n"
        ui_msg "value inside the ProgramArguments key from /usr/libexec/tftpd into ${prefix}/sbin/in.tftd\n"
        ui_msg "And start the server with service(8) command.\n"
}

