#!/bin/sh
#
# SVN Info:
#	$Id: postinst 68 2006-11-14 11:13:26Z bas $
#	$URL: trunk/DEBIAN/postinst $

DAEMON=beo_pxeconfigd
PORT=6611

PXE_TEST=`grep $DAEMON /etc/services`

if [ ! -z "$PXE_TEST" ]; then
  echo "WARNING: $DAEMON already in /etc/services"
else
  echo -e "$DAEMON\t$PORT/tcp\t\t\t# pxe config daemon\n" >> /etc/services
fi

if [ -d /etc/xinetd.d ] && [ ! -r /etc/xinetd.d/$DAEMON ]
then
    cat <<EOF >/etc/xinetd.d/$DAEMON
service $DAEMON
{
	disable         = no
	socket_type     = stream
	protocol        = tcp
	user            = root
	group           = sys
	wait            = no
	server          = /usr/sbin/$DAEMON
}
EOF

    /etc/init.d/xinetd reload

elif [ -r /etc/inetd.conf ]
then
    update-inetd --add "$DAEMON\tstream\ttcp\tnowait\troot.sys\t/usr/sbin/tcpd\t/usr/sbin/$DAEMON"
    /etc/init.d/inetd reload
fi
