#!/bin/sh
#
#       This script will remove, as necessary, the changes introduced by the
#       NCAfs, NCA Proxy and sendfilev project.
#

PATID=109234
NUNDO_REV=03

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

rmv_sock2path=1

undo_sock2path() {
	sed -e '/nca/d' $PKG_INSTALL_ROOT/etc/inet/sock2path > \
		/tmp/sock2path.$$
	cp /tmp/sock2path.$$ $PKG_INSTALL_ROOT/etc/inet/sock2path
	rm /tmp/sock2path.$$
}

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