#!/bin/sh
#
#

PATID=110615
NUNDO_REV=01

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

rmv_services=1

undo_submission() {
        sed -e '/^submission/d' $PKG_INSTALL_ROOT/etc/inet/services > \
                /tmp/submission.$$
        cp /tmp/submission.$$ $PKG_INSTALL_ROOT/etc/inet/services
        rm /tmp/submission.$$
}

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_services ] && undo_submission
exit 0
