#!/bin/sh
#
#ident	"@(#)prepatch 1.1 03/12/16 SMI"
# Copyright 2002 by Sun Microsystems, Inc.
# All rights reserved
#

# Be sure there is only one reference to this patch in the pkginfo file
# for each installed instance of SUNWppro and SUNWppmn.
SUNWS=`/usr/bin/pkginfo SUNWppro.\* SUNWppmn.\* | /usr/bin/nawk '{ print $2 }'`

for pkg in ${SUNWS}; do
    Pkgin=/var/sadm/pkg/${pkg}/pkginfo
    Pkgout=/var/sadm/pkg/${pkg}/pkginfo.tmp
    Pkgspace=/var/sadm/pkg/${pkg}/install/space

    /usr/bin/sed s/113176-01\ 113176-01/113176-01/g < ${Pkgin} > ${Pkgout} || exit -1
    /usr/bin/mv ${Pkgout} ${Pkgin}

    # This has to move the space file over for SUNWppro since that
    # confuses pkgadd.
    if [ -f "${Pkgspace}" ]; then
	/usr/bin/mv ${Pkgspace} ${Pkgspace}.not
    fi
done
