#!/bin/sh
#

PATID=109234
NUNDO_REV=03

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

undo_conf() {

fname=ncalogd.conf

sed "s:NCA Logging:NCA Log Daemon:" \
	$PKG_INSTALL_ROOT/etc/nca/ncalogd.conf > /tmp/$fname.$$

cp /tmp/$fname.$$ $PKG_INSTALL_ROOT/etc/nca/ncalogd.conf
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-03 or higher
	[ $rev -ge $NUNDO_REV ] && exit
done

undo_conf && exit

exit 0
