#!/bin/sh -e
# Pre-removal script for the Debian wu-ftpd package.

PACKAGE=wu-ftpd
BINARY=/usr/sbin/$PACKAGE

have_ftp() {
	egrep '^ftp[[:space:]]' /etc/inetd.conf >/dev/null 
}

ftp_running=no
have_ftp && ftp_running=yes

if [ "$1" != "upgrade" ]; then
	if [ "$1" = "remove" ] || [ "$1" = "deconfigure" ]
	then
		update-inetd --comment-chars '#<ftp-off>#' --pattern in.ftpd --enable ftp
	else
		update-inetd --comment-chars '#<ftp-upgrade>#' --pattern in.ftpd --enable ftp
	fi

	if test "$ftp_running" = "no"; then
		update-inetd --pattern in.ftpd --disable ftp
	fi
fi

#DEBHELPER#
