#!/bin/sh
#
# SVN Info:
#	$Id: postinst 70 2006-11-14 11:25:00Z bas $
#	$URL: tags/0.6.6/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 [ -x /etc/init.d/inetd ]
then
    update-inetd --add "$DAEMON\tstream\ttcp\tnowait\troot.sys\t/usr/sbin/tcpd\t/usr/sbin/$DAEMON"
    /etc/init.d/inetd reload
fi
