#!/bin/sh
#
#

PATID=109078
NUNDO_REV=02

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

rmv_attr=1

undo_attr() {
	sed -e '/DHCP Service/d' $PKG_INSTALL_ROOT/etc/security/auth_attr > \
		/tmp/auth_attr.$$
	cp /tmp/auth_attr.$$ $PKG_INSTALL_ROOT/etc/security/auth_attr
	rm /tmp/auth_attr.$$
	sed -e '/DHCP Management/d' $PKG_INSTALL_ROOT/etc/security/exec_attr > \
		/tmp/exec_attr.$$
	cp /tmp/exec_attr.$$ $PKG_INSTALL_ROOT/etc/security/exec_attr
	rm /tmp/exec_attr.$$
	sed -e '/DHCP Management/d' $PKG_INSTALL_ROOT/etc/security/prof_attr > \
		/tmp/prof_attr.$$
	cp /tmp/prof_attr.$$ $PKG_INSTALL_ROOT/etc/security/prof_attr
	rm /tmp/prof_attr.$$
}

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