#!/bin/sh
# $Revision: 1.32 $
#bcpyrght
#***************************************************************************
#* $VRTScprght: Copyright 1993 - 2002 VERITAS Software Corporation, All Rights Reserved $ *
#***************************************************************************
#ecpyrght
#
# You need to be root to run this script.
#
# This script fixes up the files on the client so that they are in the correct
# place and have the needed permissions. It moves the files from /tmp/bp/bin
# to /usr/openv/netbackup/bin. It then fixes up the permissions and updates the
# /etc/services file to add bprd, bpcd, bpjava-msvc and vopied. It also fixes up
# /etc/inetd.conf with bpcd, bpjava-msvc and vopied.

# The following variable is changed by the Makefile to a valid value.
MACHINE=Solaris2

# do_netinfo_service - add a service entry for Mac OS X or Mac OS X Server
#
# These OSes use the NetInfo utilities to administrate services rather than
# the /etc/services file.
#
# do_netinfo_service <file_name>
#
#	<file_name>	file containing a single services line.

do_netinfo_service () {
	service_file="${1}"
	service_name=`awk '{print $1}' < "${service_file}"`
	service_port=`awk '{print $2}' < "${service_file}" | \
	    awk -F/ '{print $1}'`
	current_protocol=`niutil -readprop . /services/"${service_name}" \
	    protocol 2> /dev/null`
	current_port=`niutil -readprop . /services/"${service_name}" port 2> \
	    /dev/null`
	if [ \( "${current_protocol}" != 'tcp' \) -o \
	     \( "${current_port}" = '' \) ] ; then
		niutil -create . /services/"${service_name}" > /dev/null 2>&1
		niutil -createprop . /services/"${service_name}" protocol \
		    tcp > /dev/null 2>&1
		niutil -createprop . /services/"${service_name}" port \
		    "${service_port}" > /dev/null 2>&1
		current_protocol=`niutil -readprop . \
		    /services/"${service_name}" protocol 2> /dev/null`
		current_port=`niutil -readprop . /services/"${service_name}" \
		    port 2> /dev/null`
	fi
	if [ \( "${current_protocol}" != 'tcp' \) -o \
	     \( "${current_port}" = '' \) ] ; then
		return 1
	fi
	return 0
}
# -----------------------------------------------------------------------------
# Add files to xinetd.d directory for NetBackup services if xinetd is used.
#
ck_xinetd  () {

        entry=$1

if [ -f /etc/xinetd.d/${entry} ] ; then
        /bin/cp /dev/null /tmp/bp_services_updated
else
        /bin/echo "# Service $entry for NetBackup
service $entry
{
        socket_type             = stream
        protocol                = tcp
        wait                    = no
        user                    = root" >> /etc/xinetd.d/${entry}
                if [ $entry = vopied ] ; then
                        /bin/echo "        server                  = /usr/openv/bin/$entry" >> /etc/xinetd.d/${entry}
                else
                        /bin/echo "        server                  = /usr/openv/netbackup/bin/$entry" >> /etc/xinetd.d/${entry}
                fi
                if [ $entry = bpcd ] ; then
                        /bin/echo "        cps                     = 300" >> /etc/xinetd.d/${entry}
                fi
                if [ $entry = bpjava-msvc ] ; then
                        /bin/echo "        server_args             = -transient" >> /etc/xinetd.d/${entry}
                fi
        /bin/echo "        disable                 = no" >> /etc/xinetd.d/${entry}
        /bin/echo "}" >> /etc/xinetd.d/${entry}


fi

}
# -----------------------------------------------------------------------------

case "${MACHINE}" in
	HP*)
		Tar_x_Options=xof
		DSO_SUFFIX='sl'
		;;
	Linux | Solaris*)
		Tar_x_Options=xvpf
		DSO_SUFFIX='so'
		;;
	*)
		DSO_SUFFIX='so'
		;;
esac

if [ -d /tmp/bp/bin ] ; then
	/bin/mkdir /usr/openv 2> /dev/null
	/bin/chmod 755 /usr/openv
	mkdir /usr/openv/netbackup 2> /dev/null
	chmod 755 /usr/openv/netbackup
	mkdir /usr/openv/netbackup/logs 2> /dev/null
	chmod 755 /usr/openv/netbackup/logs
	mkdir /usr/openv/netbackup/logs/user_ops 2> /dev/null
	chmod 1777 /usr/openv/netbackup/logs/user_ops
	mkdir /usr/openv/netbackup/bin 2> /dev/null
	chmod 755 /usr/openv/netbackup/bin
	mkdir /usr/openv/bin 2> /dev/null
	chmod 755 /usr/openv/bin
	mkdir /usr/openv/lib 2> /dev/null
	chmod 755 /usr/openv/lib
	mkdir /usr/openv/var 2> /dev/null
	chmod 755 /usr/openv/var
	mkdir /usr/openv/var/auth 2> /dev/null
	chmod 755 /usr/openv/var/auth
	if [ -d /tmp/bp/java ] ; then
		DoJava=Yes
		if [ ${MACHINE} = "Linux" ] ; then
			HardWare=`uname -m | cut -c3-4`
			Version=`uname -r | cut -f 1 -d- | awk -F. '{print ($1*1000 + $2*100 + $3)}'`
			if [ $HardWare = 86 -a $Version -ge 2214 ] ; then
				: # All is well on an intel with a new enough kernel
			else
				DoJava=No
			fi
		fi
		if [ $DoJava = Yes ] ; then
			mkdir /usr/openv/java 2> /dev/null
			chmod 755 /usr/openv/java
			mkdir /usr/openv/java/logs 2> /dev/null
			chmod 777 /usr/openv/java/logs
		else
			rm -rf /tmp/bp/java
		fi
	fi

	/bin/cp /tmp/bp/bin/* /usr/openv/netbackup/bin/

	# move authentication files
	if [ -f /usr/openv/netbackup/bin/vopied ] ; then
		/bin/mv /usr/openv/netbackup/bin/vopied /usr/openv/bin/
	fi
	if [ -f /usr/openv/netbackup/bin/vauth_util ] ; then
		/bin/mv /usr/openv/netbackup/bin/vauth_util /usr/openv/bin/
	fi
	if [ -f /usr/openv/netbackup/bin/vauth_test ] ; then
		/bin/mv /usr/openv/netbackup/bin/vauth_test /usr/openv/bin/
	fi
	if [ -f /usr/openv/netbackup/bin/vauth_testd ] ; then
		/bin/mv /usr/openv/netbackup/bin/vauth_testd /usr/openv/bin/
	fi
	if [ -f /usr/openv/netbackup/bin/vopie_util ] ; then
		/bin/mv /usr/openv/netbackup/bin/vopie_util /usr/openv/bin/
	fi
	if [ -f /usr/openv/netbackup/bin/libvnoauth.${DSO_SUFFIX} ] ; then
		/bin/mv /usr/openv/netbackup/bin/libvnoauth.${DSO_SUFFIX} \
		    /usr/openv/lib/
	fi
	if [ -f /usr/openv/netbackup/bin/libvopie.${DSO_SUFFIX} ] ; then
		/bin/mv /usr/openv/netbackup/bin/libvopie.${DSO_SUFFIX} \
		    /usr/openv/lib/
	fi
	if [ -f /usr/openv/netbackup/bin/template.methods.txt ] ; then
		/bin/mv /usr/openv/netbackup/bin/template.methods.txt \
		    /usr/openv/var/auth/
	fi
	if [ -f /usr/openv/netbackup/bin/template.methods_allow.txt ] ; then
		/bin/mv /usr/openv/netbackup/bin/template.methods_allow.txt \
		    /usr/openv/var/auth/
	fi
	if [ -f /usr/openv/netbackup/bin/template.methods_deny.txt ] ; then
		/bin/mv /usr/openv/netbackup/bin/template.methods_deny.txt \
		    /usr/openv/var/auth/
	fi
	if [ -f /usr/openv/netbackup/bin/template.names_allow.txt ] ; then
		/bin/mv /usr/openv/netbackup/bin/template.names_allow.txt \
		    /usr/openv/var/auth/
	fi
	if [ -f /usr/openv/netbackup/bin/template.names_deny.txt ] ; then
		/bin/mv /usr/openv/netbackup/bin/template.names_deny.txt \
		    /usr/openv/var/auth/
	fi

	mkdir /usr/openv/netbackup/help 2> /dev/null
	chmod 755 /usr/openv/netbackup/help
	mkdir /usr/openv/netbackup/help/bp 2> /dev/null
	chmod 755 /usr/openv/netbackup/help/bp
	/bin/cp /tmp/bp/help/bp/* /usr/openv/netbackup/help/bp

	if [ "$MACHINE" = 'MACINTOSH' ] ; then
		# ignore X help and config files for MacOSXS
		rm -f /tmp/bp/bin/xbp
	fi
	if [ -f /tmp/bp/bin/xbp ] ; then
		if [ ! -d /usr/lib ] ; then
			mkdir /usr/lib
			chmod 755 /usr/lib
		fi
		if [ ! -d /usr/lib/X11 ] ; then
			mkdir /usr/lib/X11
			chmod 755 /usr/lib/X11
		fi
		if [ ! -f /usr/lib/X11/XKeysymDB ] ; then
			/bin/cp /tmp/bp/XKeysymDB /usr/lib/X11/XKeysymDB
			chmod 444 /usr/lib/X11/XKeysymDB
		fi
		mkdir /usr/openv/netbackup/help/xbp 2> /dev/null
		chmod 755 /usr/openv/netbackup/help/xbp
		/bin/cp /tmp/bp/help/xbp/* /usr/openv/netbackup/help/xbp
	fi
	# Merge in the new servers into bp.conf if told to.
	if [ -f /usr/openv/netbackup/bp.conf ] ; then
		if [ "$1"eave_bp.conf != "-Leave_bp.conf" ] ; then
			/bin/cat /usr/openv/netbackup/bp.conf |
			while read FILE1
			do
				# If $FILE1 is not blank.
				if [ X"${FILE1}" != X ] ; then
					# Check if first word in the line is SERVER
					ID1=`/bin/echo $FILE1 | awk -F= '{print $1}'`
					SERVER1=`/bin/echo $FILE1 | awk -F= '{print $2}'`
					# Might need to trim white space from awk output
					ID1=`/bin/echo ${ID1}`
					SERVER1=`/bin/echo ${SERVER1}`
					if [ "${ID1}" = "SERVER" ] ; then
						# Go through the current servers and
						# check to see if it already exists.
						/bin/rm -f /tmp/bp/server_found
						/bin/cat /tmp/bp/bp_servers |
						while read FILE2
						do
							SERVER2=`/bin/echo $FILE2 | awk -F= '{print $2}'`
							SERVER2=`/bin/echo ${SERVER2}`
							if [ "${SERVER1}" = "${SERVER2}" ] ; then
								/bin/cp /dev/null /tmp/bp/server_found
							fi
						done

						# Add the server to a tmp file.
						if [ ! -f /tmp/bp/server_found ] ; then
							/bin/echo "${FILE1}" >>/tmp/bp/bp.conf.add
						fi
					elif [ "${ID1}" = "CLIENT_NAME" ] ; then
						/bin/cp /dev/null /tmp/bp/cli_name_found
						/bin/echo "${FILE1}" >>/tmp/bp/bp.conf.add
					else
						# Not a SERVER entry, copy to bp.conf.add.
						/bin/echo "${FILE1}" >>/tmp/bp/bp.conf.add
					fi
				else
					/bin/echo "${FILE1}" >>/tmp/bp/bp.conf.add
				fi
			done

			# Copy the new /tmp/bp/bp_servers to bp.conf
			/bin/cp /tmp/bp/bp_servers /usr/openv/netbackup/bp.conf

			# Add any of the old entries from bp.conf that
			# aren't in the new /tmp/bp/bp_servers file.
			if [ -f /tmp/bp/bp.conf.add ] ; then
				/bin/cat /tmp/bp/bp.conf.add >>/usr/openv/netbackup/bp.conf
			fi

			if [ ! -f /tmp/bp/cli_name_found ] ; then
				/bin/cat /tmp/bp/bp_client_name >>/usr/openv/netbackup/bp.conf
			fi
		fi
	else
		/bin/cp /tmp/bp/bp_servers /usr/openv/netbackup/bp.conf
		/bin/cat /tmp/bp/bp_client_name >>/usr/openv/netbackup/bp.conf
	fi
fi

# Create dir for dbext software
/bin/mkdir /usr/openv/netbackup/dbext 2> /dev/null
/bin/chmod 755 /usr/openv/netbackup/dbext
# Create dir for NB addon libraries
/bin/mkdir /usr/openv/lib 2> /dev/null
/bin/chmod 755 /usr/openv/lib

# Set the permissions on the files.
chmod 644 /usr/openv/netbackup/bp.conf
chmod 555 /usr/openv/netbackup/bin/bp
chmod 500 /usr/openv/netbackup/bin/bpcd
chmod 555 /usr/openv/netbackup/bin/bpjava-msvc
chmod 555 /usr/openv/netbackup/bin/bpjava-usvc
chmod 555 /usr/openv/netbackup/bin/bpbkar
chmod 555 /usr/openv/netbackup/bin/bpbackup
chmod 555 /usr/openv/netbackup/bin/bprestore
chmod 555 /usr/openv/netbackup/bin/bplist
chmod 555 /usr/openv/netbackup/bin/bpclimagelist
chmod 555 /usr/openv/netbackup/bin/bpclntcmd
chmod 555 /usr/openv/netbackup/bin/bpdynamicclient
chmod 444 /usr/openv/netbackup/bin/bprd_service 2> /dev/null
chmod 444 /usr/openv/netbackup/bin/bpcd_service 2> /dev/null
chmod 444 /usr/openv/netbackup/bin/vopied_service 2> /dev/null
chmod 444 /usr/openv/netbackup/bin/bpjava_service 2> /dev/null
chmod 444 /usr/openv/netbackup/bin/bpcd_inetd.cnf 2> /dev/null
chmod 444 /usr/openv/netbackup/bin/vopied_inetd.cnf 2> /dev/null
chmod 444 /usr/openv/netbackup/bin/bpjava_inetd.cnf 2> /dev/null
chmod 644 /usr/openv/netbackup/bin/version
chmod 444 /usr/openv/netbackup/help/bp/*
if [ -f /usr/openv/bin/vopied ] ; then
	chmod 555 /usr/openv/bin/vopied
fi
if [ -f /usr/openv/bin/vauth_util ] ; then
	chmod 555 /usr/openv/bin/vauth_util
fi
if [ -f /usr/openv/bin/vauth_test ] ; then
	chmod 555 /usr/openv/bin/vauth_test
fi
if [ -f /usr/openv/bin/vauth_testd ] ; then
	chmod 555 /usr/openv/bin/vauth_testd
fi
if [ -f /usr/openv/bin/vopie_util ] ; then
	chmod 555 /usr/openv/bin/vopie_util
fi
if [ -f /usr/openv/lib/libvnoauth.${DSO_SUFFIX} ] ; then
	chmod 555 /usr/openv/lib/libvnoauth.${DSO_SUFFIX}
fi
if [ -f /usr/openv/lib/libvopie.${DSO_SUFFIX} ] ; then
	chmod 555 /usr/openv/lib/libvopie.${DSO_SUFFIX}
fi
if [ -f /usr/openv/netbackup/bin/merge_auth_templates ] ; then
	chmod 500 /usr/openv/netbackup/bin/merge_auth_templates
fi
if [ -f /usr/openv/var/auth/template.methods.txt ] ; then
	chmod 444 /usr/openv/var/auth/template.methods.txt
fi
if [ -f /usr/openv/var/auth/template.methods_allow.txt ] ; then
	chmod 444 /usr/openv/var/auth/template.methods_allow.txt
fi
if [ -f /usr/openv/var/auth/template.methods_deny.txt ] ; then
	chmod 444 /usr/openv/var/auth/template.methods_deny.txt
fi
if [ -f /usr/openv/var/auth/template.names_allow.txt ] ; then
	chmod 444 /usr/openv/var/auth/template.names_allow.txt
fi
if [ -f /usr/openv/var/auth/template.names_deny.txt ] ; then
	chmod 444 /usr/openv/var/auth/template.names_deny.txt
fi
if [ -x /usr/openv/netbackup/bin/merge_auth_templates ] ; then
	/usr/openv/netbackup/bin/merge_auth_templates
fi

if [ -f /usr/openv/netbackup/bin/rbak ] ; then
	chmod 555 /usr/openv/netbackup/bin/rbak
else
	chmod 555 /usr/openv/netbackup/bin/tar
fi

if [ -f /usr/openv/netbackup/bin/bphdb ] ; then
	chmod 555 /usr/openv/netbackup/bin/bphdb
fi

if [ -f /usr/openv/netbackup/bin/bpmount ] ; then
	chmod 555 /usr/openv/netbackup/bin/bpmount
fi

if [ -f /usr/openv/netbackup/bin/xbp ] ; then
	chmod 555 /usr/openv/netbackup/bin/xbp
fi
if [ -d /usr/openv/netbackup/help/xbp ] ; then
	chmod 444 /usr/openv/netbackup/help/xbp/*
fi

cd /usr/openv/netbackup/bin
/bin/rm -rf bparchive
ln -s bpbackup bparchive

/bin/rm -rf /tmp/bp_services_updated

if [ "$MACHINE" != 'MACINTOSH' ] ; then

bprd=`grep bprd /etc/services`
bpcd=`grep bpcd /etc/services`
vopied=`grep vopied /etc/services`
bpjava=`grep bpjava-msvc /etc/services`

if [ X"${bprd}" = X -a X"${bpcd}" = X -a X"${vopied}" = X -a X"${bpjava}" = X ] ; then
	# We need to add all of them.
	/bin/echo " #" >>/etc/services
	/bin/echo " # OpenV*NetBackup services" >>/etc/services
	/bin/echo " #" >>/etc/services
fi
# Add bprd to the /etc/services file if necessary.
if [ "${bprd}" = "" ] ; then
	cat /usr/openv/netbackup/bin/bprd_service >>/etc/services
	/bin/cp /dev/null /tmp/bp_services_updated
fi

# Add bpcd to the /etc/services file if necessary.
if [ "${bpcd}" = "" ] ; then
	cat /usr/openv/netbackup/bin/bpcd_service >>/etc/services
	/bin/cp /dev/null /tmp/bp_services_updated
fi

# Add vopied to the /etc/services file if necessary.
if [ "${vopied}" = "" ] ; then
	cat /usr/openv/netbackup/bin/vopied_service >>/etc/services
	/bin/cp /dev/null /tmp/bp_services_updated
fi

# Add bpjava-msvc to the /etc/services file if necessary.
if [ "${bpjava}" = "" ] ; then
	cat /usr/openv/netbackup/bin/bpjava_service >>/etc/services
	/bin/cp /dev/null /tmp/bp_services_updated
fi

else # "$MACHINE" = 'MACINTOSH'

	# MacOS X and MacOS X Server use the NetInfo utilities
	# rather than /etc/services to configure network services.

	do_netinfo_service /usr/openv/netbackup/bin/bpcd_service
	do_netinfo_service /usr/openv/netbackup/bin/bprd_service
	do_netinfo_service /usr/openv/netbackup/bin/vopied_service
	do_netinfo_service /usr/openv/netbackup/bin/bpjava_service

fi

# Determine location of inetd.conf file.
INETD_CONF=/etc/inetd.conf

if [ "${MACHINE}" = "SGI" -o "${MACHINE}" = "NCR" ] ; then
	if [ -f /usr/etc/inetd.conf ] ; then
		INETD_CONF=/usr/etc/inetd.conf
	fi
	if [ "${MACHINE}" = "NCR" ] ; then
		if [ -f /etc/inet/inetd.conf ] ; then
			INETD_CONF=/etc/inet/inetd.conf
		fi
	fi
fi

# Add our daemons to the /etc/xinetd.d directory if necessary.
if [ -d /etc/xinetd.d ] ; then
        ck_xinetd bpcd
        ck_xinetd vopied
        ck_xinetd bpjava-msvc
	/bin/echo "Reloading xinetd configuration"
	/etc/rc.d/init.d/xinetd reload
fi

# Add bpcd to the inetd.conf file if necessary.
bpcd_inetd=`grep bpcd $INETD_CONF`

if [ "${bpcd_inetd}" = "" ] ; then
	cat /usr/openv/netbackup/bin/bpcd_inetd.cnf >>$INETD_CONF
	/bin/cp /dev/null /tmp/bp_services_updated
fi

# Add vopied to the inetd.conf file if necessary.
vopied_inetd=`grep vopied $INETD_CONF`

if [ "${vopied_inetd}" = "" ] ; then
	cat /usr/openv/netbackup/bin/vopied_inetd.cnf >>$INETD_CONF
	/bin/cp /dev/null /tmp/bp_services_updated
fi

# Add bpjava-msvc to the inetd.conf file if necessary.
bpjava_inetd=`grep bpjava-msvc $INETD_CONF`

if [ "${bpjava_inetd}" = "" ] ; then
	cat /usr/openv/netbackup/bin/bpjava_inetd.cnf >>$INETD_CONF
	/bin/cp /dev/null /tmp/bp_services_updated
fi

if [ "${MACHINE}" = "NCR" ] ; then
	if [ "${INETD_CONF}" = "/etc/inet/inetd.conf" ] ; then
		INETD_CONF_LOCAL=/etc/inet/inetd.local
		if [ -f $INETD_CONF_LOCAL ] ; then
			bpcd_inetd=`grep bpcd $INETD_CONF_LOCAL`
			vopied_inetd=`grep vopied $INETD_CONF_LOCAL`
			bpjava_inetd=`grep bpjava-msvc $INETD_CONF_LOCAL`
		else
			bpcd_inetd=""
			vopied_inetd=""
			bpjava_inetd=""
		fi
		if [ "${bpcd_inetd}" = "" ] ; then
			cat /usr/openv/netbackup/bin/bpcd_inetd.cnf >>$INETD_CONF_LOCAL
		fi
		if [ "${vopied_inetd}" = "" ] ; then
			cat /usr/openv/netbackup/bin/vopied_inetd.cnf >>$INETD_CONF_LOCAL
		fi
		if [ "${bpjava_inetd}" = "" ] ; then
			cat /usr/openv/netbackup/bin/bpjava_inetd.cnf >>$INETD_CONF_LOCAL
		fi
	fi
elif [ "${MACHINE}" = "RS6000" ] ; then
	# We need to call inetimp if we update /etc/services or inetd.conf.
	if [ -f /tmp/bp_services_updated ] ; then
		if [ -f /usr/bin/inetimp ] ; then
			/usr/bin/inetimp
		fi
		/bin/rm -rf /tmp/bp_services_updated
	fi
fi

# Remove the services files.
HEREIAM=`pwd`
cd /usr/openv/netbackup/bin
/bin/rm -f bprd_service bpcd_service vopied_service bpjava_service bpcd_inetd.cnf vopied_inetd.cnf bpjava_inetd.cnf

if [ -d /tmp/bp/java ] ; then
	cd /usr/openv
	if [ -f /usr/openv/java/auth.conf ] ; then
		mv /usr/openv/java/auth.conf /usr/openv/java/auth.conf.bak
	fi
	# Clean out the vrts dir hierarchy first.
	rm -rf /usr/openv/java/vrts
	zcat /tmp/bp/NB-Java.tar.Z | /bin/tar ${Tar_x_Options} - >/dev/null
	rm -f NB-Java.tar.Z
	rm -f /usr/openv/java/auth.conf
	if [ -f /usr/openv/java/auth.conf.bak ] ; then
		mv /usr/openv/java/auth.conf.bak /usr/openv/java/auth.conf
	fi
	cd /usr/openv/java
	# Clean out the jre dir hierarchy first.
	rm -rf jre
	zcat /tmp/bp/java/*.tar.Z | /bin/tar ${Tar_x_Options} - >/dev/null
	rm -f *.tar.Z
	cp /tmp/bp/java/nbj.conf /usr/openv/java/
	rm -f /usr/openv/netbackup/bin/jnbSA /usr/openv/netbackup/bin/jbpSA
	if [ `uname -m` != "i86pc" ] ; then
		ln -s /usr/openv/java/jnbSA /usr/openv/netbackup/bin/jnbSA
	fi
	ln -s /usr/openv/java/jbpSA /usr/openv/netbackup/bin/jbpSA

	# Copy in our font.properties file.
	mv jre/lib/font.properties jre/lib/font.properties.bak
	mv font.properties jre/lib/
	## Make the java/awt dir for class files to work around the finalizer hang ..
	mkdir -p -m 755 /usr/openv/java/java/awt
	mv Finalize2.class java/awt/
	mv Graphics*.class java/awt/
	mv SecondaryFinalizer.class java/awt/
	mv Component*.class java/awt/

	# clean up old binaries from /usr/openv/java
	rm -f GnuRe.jar jcchart400J.jar linux_blackdown_jre117B.tar.Z
	rm -f hp110_jre130_beta.tar.Z j2re-1_3_0-beta_refresh-linux.tar.Z
	rm -f j2re1_3_0beta_refresh-solsparc.bin j2re1_3_0rc-solsparc.bin
	rm -f j2re1_3_0rc-solx86.bin jre130_aix.tar.Z Solaris_X86_JRE_117B.tar.Z
	rm -f Solaris_JRE_117B.tar.Z hp1020_jre116.tar.Z hp110_jre116.tar.Z
	rm -f X11FMFix.jar
fi

cd ${HEREIAM}

# Remove the /tmp/bp files.
if [ -d /tmp/bp/bin ] ; then
	/bin/rm -rf /tmp/bp
fi

# We need to find the process number for inetd so that we can
# send a SIGHUP so that it will reread its inetd.conf file.
if [ "${MACHINE}" = "Sun4" ] ; then
	inetd=`/bin/ps -aux|grep inetd|grep -v grep|grep -v osinetd|awk '{print $2}'`
	/bin/kill -1 $inetd
elif [ "${MACHINE}" = "DGUX" ] ; then
	inetd=`/bin/ps -e|grep inetd|grep -v grep|grep -v osinetd|awk '{print $1}'`
	/bin/kill -1 $inetd
elif [ "${MACHINE}" = "Linux" ] ; then
	inetd=`/bin/ps aux|grep inetd|grep -v grep|grep -v osinetd|awk '{print $2}'`
	/bin/kill -1 $inetd
elif [ "${MACHINE}" = "FreeBSD" ] ; then
	inetd=`/bin/ps aux | grep inetd| grep -v grep |grep -v osinetd| awk '{print $2}'`
	/bin/kill -HUP $inetd
elif [ "${MACHINE}" = "MACINTOSH" ] ; then
	inetd=`/bin/ps -aux | grep inetd | grep -v grep |grep -v osinetd| awk '{print $2}'`
	/bin/kill -HUP $inetd
elif [ "${MACHINE}" = "Sequent" ] ; then
	inetd=`/bin/ps -ef|grep inetd|grep -v grep|grep -v rpc.inetd|grep -v osinetd|awk '{print $2}'`
	/bin/kill -1 $inetd
else
	inetd=`/bin/ps -ef|grep inetd|grep -v grep|grep -v osinetd|awk '{print $2}'`
	/bin/kill -1 $inetd
fi
