#! /sbin/sh
########
# Product: Ignite-UX
# Fileset: FILE-SRV-*
# unconfigure
# @(#) $Revision: 10.6 $
########
#
# (c) Copyright Hewlett-Packard Company 1994
#
########################################################################

##########################################################################
# This script does the following:
#
# Removes the INDEX file entries for all HP-UX releases that this fileset
# supports.
# 

UTILS=/usr/lbin/sw/control_utils
if [ -f $UTILS ]
then
    . $UTILS
else
    echo "ERROR:   Cannot find $UTILS"
    exit 1
fi


case $FILESET in
FILESRV-1123IA)
    RELEASE=B.11.23;;
FILESRV-1123PA)
    RELEASE=B.11.23;;
FILESRV-1122IA)
    RELEASE=B.11.22;;
FILESRV-1122PA)
    RELEASE=B.11.22;;
FILE-SRV-11-11)
    RELEASE=B.11.11;;
FILE-SRV-11-10)
    RELEASE=B.11.10;;
FILE-SRV-11-00)
    RELEASE=B.11.00;;
FILE-SRV-10-30)
    RELEASE=B.10.30;;
FILE-SRV-10-20)
    RELEASE=B.10.20;;
FILE-SRV-10-10)
    RELEASE=B.10.10;;
FILE-SRV-10-01)
    RELEASE=B.10.01;;
*)
    echo "ERROR:   Script ($FILESET) does not match a recognized release"
    exit 1;;
esac

INST_DIR=/opt/ignite
VAR_DIR=/var/opt/ignite
VAR_INDEX=$VAR_DIR/INDEX

TAG="HP-UX $RELEASE Default"

if grep -q "$TAG" $VAR_INDEX 2>/dev/null
then
    #
    # determine the architecture we are running on and set the location of
    # native binaries to link to /opt/ignite/bin and /opt/ignite/lbin
    ############
    case $(uname -m) in
        ia64*) bindir=/opt/ignite/binia
               lbindir=/opt/ignite/lbinia
               ;;
            *) bindir=/opt/ignite/binpa
               lbindir=/opt/ignite/lbinpa
               ;;
    esac

    if [[ -x /opt/ignite/bin/manage_index ]]; then
        manageindex=/opt/ignite/bin/manage_index
    elif [[ -x ${bindir}/manage_index ]]; then
        manageindex=${bindir}/manage_index
    fi

    ${manageindex} -d -r ${RELEASE}

fi

exit $SUCCESS
