#!/bin/sh
#

PATID=109078
NUNDO_REV=02

INFO="$PKG_INSTALL_ROOT/var/sadm/pkg/SUNWdhcsr/pkginfo"
pids=`egrep '^PATCHLIST' $INFO | nawk -F= '{print $2}'`

undo_edhcp() {
fname=dhcp
cat >/tmp/$fname.$$ <<\EOF
#!/sbin/sh
#
# Copyright (c) 1996-1999 by Sun Microsystems, Inc.
# All rights reserved.
#
#ident	"@(#)dhcp	1.17	99/10/23 SMI"

# Make sure that /usr is mounted
[ ! -d /usr/bin ] && exit 1

case "$1" in
'start')
	if [ -x /usr/lib/inet/in.dhcpd ]; then
		/usr/lib/inet/in.dhcpd > /dev/console 2>&1
	fi
	;;

'stop')
	/usr/bin/pkill -x -u 0 in.dhcpd
	;;

*)
	echo "Usage: $0 { start | stop }"
	exit 1
	;;
esac
exit 0
EOF

cp /tmp/$fname.$$ $PKG_INSTALL_ROOT/etc/init.d/$fname
rm /tmp/$fname.$$

return 0

}

for i in `echo $pids`; do
	echo $i | egrep -s $PATID || continue
	rev=`expr //$i : '.*-\(.*\)'`
	#No undo edits for rev-02 or higher
	[ $rev -ge $NUNDO_REV ] && exit
done

undo_edhcp && exit

exit 0
