#!/bin/sh
#
# Authors: Bas van der Vlies
#
# SVN Info:
#	$Id: postinst 87 2007-03-29 07:40:41Z bas $
#
DAEMON=pxeconfigd
PORT=6611

SHARE_DIR=/usr/share/doc/pxeconfig

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 ]
then
	if [ ! -r /etc/xinetd.d/$DAEMON ]
	then
		cp $SHARE_DIR/examples/pxeconfigd.xinetd /etc/xinetd.d/$DAEMON
		/etc/init.d/xinetd reload
	fi
else
  	/usr/sbin/update-inetd --group OTHER --add "$DAEMON stream  tcp  nowait  root.sys /usr/sbin/tcpd  /usr/sbin/$DAEMON"
	/etc/init.d/inetd reload
fi
