#!/bin/sh
# $Id: postinst,v 1.7 2003/06/21 02:31:44 herbert Exp $

set -e

if grep -q '[[:blank:]]/usr/sbin/in\.ftpd.*-z' /etc/inetd.conf 2>/dev/null; then
	update-inetd --pattern '/usr/sbin/in\.ftpd' --remove ".*ftp"
fi

if grep -q '[[:blank:]]/usr/sbin/in\.ftpd\>' /etc/inetd.conf 2>/dev/null; then
	if ! grep -q '^ftp\>' /etc/inetd.conf; then
		update-inetd --pattern '/usr/sbin/in\.ftpd' --multi --enable ftp
	fi
else
	FTPENTRY="ftp		stream	tcp	nowait	root	/usr/sbin/tcpd	/usr/sbin/in.ftpd"
	if grep -q '^ftp\>' /etc/inetd.conf 2>/dev/null; then
		update-inetd --group STANDARD --add "## $FTPENTRY"
	else
		update-inetd --group STANDARD --add "$FTPENTRY"
	fi
fi

if [ ! -f /etc/inetd.conf -a -d /etc/xinetd.d -a -x /usr/sbin/xinetd ]; then
	cat <<-TEXT
		------------------------------------------------
		There is an example configuration for using ftpd
		under the control of xinetd. It is delivered as

		    /usr/share/doc/fptd/examples/ftpd.xinetd
		------------------------------------------------
	TEXT
fi

#DEBHELPER#
