#!/bin/sh 
#
#ident  "@(#)postbackout.src 1.4     02/08/02 SMI"
#
# Copyright (c) 2001, by Sun Microsystems, Inc.
# All rights reserved.
#
# Check if the interconnect has been configured. If so,
# update the firmware on all units as soon as the patch 
# is removed.
#

UT_ROOTDIR=${2:-/}

HOSTS=${UT_ROOTDIR}/etc/inet/hosts
HOSTNAME_R=${UT_ROOTDIR}/etc/hostname

# get a list of existing Sun Ray interfaces

grep 'SUNRAY ADD' ${HOSTS} | awk '{ print $2 }' >/tmp/newthosts.$$
fgrep -l -f /tmp/newthosts.$$ ${HOSTNAME_R}.* 2>/dev/null | sed "s!${HOSTNAME_R}.!!" >/tmp/newtifs.$$
rm /tmp/newthosts.$$ 2>/dev/null

INTFS=`cat /tmp/newtifs.$$`
rm /tmp/newtifs.$$ 2>/dev/null

# Check if the Sun Ray interconnect has been configured

if [ ! -z "${INTFS}" ]; then
	UT_BASEDIR=`pkginfo -R ${UT_ROOTDIR} -r SUNWuto`
	/var/tmp/${PatchNum}/utfwadm -R
	/var/tmp/${PatchNum}/utfwadm -A -a -n all
fi

/bin/rm -rf /var/tmp/${PatchNum}
