#!/sbin/sh
#------------------------------------------------------------------#
#
# HPUX_ID: @(#) $Revision: 5.1 $ generated on Mon Mar  9 14:16:59 EST 1998
#
# (c)Copyright 1983-1996 Hewlett-Packard Co.,  All Rights Reserved.
#
#------------------------------------------------------------------#
# SD postremove script template for 11.X patches.                  #
#------------------------------------------------------------------#
# This file is optional for all 11.X patches.  The purpose of this #
# script is to prepare for a kernel build when required by the     #
# install conditions.  The script can also drive events that must  #
# occur before a system reboot occurs.                             #
#------------------------------------------------------------------#

_PATCHID=PHCO_23966

UTILS="/usr/lbin/sw/control_utils"

if [ ! -f $UTILS ]; then
    echo "ERROR:   Cannot find $UTILS"
    exit 1
fi

. $UTILS
exitval=$SUCCESS

#####
##### Insert any code you may require at this point in the script.
##### Pay attention to the exitval variable and set appropriately
##### in your code.  If you are unsure as to what types of operations
##### are legal in this file and what types aren't, consult the 
##### "Guidelines for SD Control Scripts" document.
#####
##### START_CUSTOMIZATION_HERE

# remove .latest_behavior_on file if present
BEHAVIOR_FILE=/var/adm/sw/.latest_behavior_on

if [ -r ${SW_ROOT_DIRECTORY}${BEHAVIOR_FILE} ]
then
    rm -r ${SW_ROOT_DIRECTORY}${BEHAVIOR_FILE} >/dev/null 2>&1
fi


#  If the SW_GETTOOLS versions of these commands exist on the system
#  then restore the links to that version.  They were probably removed
#  by the preremove script for this fileset


    if [[ -f /usr/sbin/swinstall ]] && [[ -f /var/adm/sw/sbin/swinstall ]]
	then

	mv /usr/sbin/swinstall  /usr/sbin/swinstall#
	ln -s  /var/adm/sw/sbin/swinstall  /usr/sbin/swinstall

	rm /usr/sbin/swacl
	ln -s  /var/adm/sw/sbin/swacl  /usr/sbin/swacl

	rm /usr/sbin/swconfig
	ln -s  /var/adm/sw/sbin/swconfig  /usr/sbin/swconfig
	
        rm /usr/sbin/swlist
        ln -s  /var/adm/sw/sbin/swlist  /usr/sbin/swlist

	rm /usr/sbin/swreg
	ln -s  /var/adm/sw/sbin/swreg  /usr/sbin/swreg

	rm /usr/sbin/swremove
	ln -s  /var/adm/sw/sbin/swremove  /usr/sbin/swremove

	rm /usr/sbin/swverify
	ln -s  /var/adm/sw/sbin/swverify  /usr/sbin/swverify

	rm /usr/sbin/swjob
	ln -s  /var/adm/sw/sbin/swjob  /usr/sbin/swjob

	rm /usr/sbin/swcopy
	ln -s  /var/adm/sw/sbin/swcopy  /usr/sbin/swcopy

	rm /usr/sbin/sd
	ln -s  /var/adm/sw/sbin/sd  /usr/sbin/sd


    fi


    if [[ -f /usr/sbin/swpackage ]] && [[ -f /var/adm/sw/sbin/swpackage ]]
	then

	mv /usr/sbin/swpackage /usr/sbin/swpackage#
	ln -s /var/adm/sw/sbin/swpackage /usr/sbin/swpackage

	rm /usr/sbin/swmodify
	ln -s /var/adm/sw/sbin/swmodify /usr/sbin/swmodify

    fi

    

exit $exitval
