#!/bin/ksh
#
#       @(#)disk0_install.sh 1.110 98/04/18 SMI
#
# Copyright (c) 1992-1998 Sun Microsystems, Inc.  All Rights Reserved.
#

trap "" 1 2 3 15
LOG_FILE=disk0_install.log
echo "disk0-> disk0_install.sh - `date`"   >> /tmp/$LOG_FILE 2>&1
RUNFLAG=n

RELEASE=`uname -r`
# Local Variables
PATH=$PATH:./:/sbin:/usr/sbin:/usr/java/bin:/usr/dt/bin; export PATH
SWAP_FILE="/swap2"
HOME=/tmp/root
WIZDIR=/webstart/wizards/apps
NOWIN_FILE="/tmp/.nowin"

JAVA_COMPILER=NONE;export JAVA_COMPILER
# Setup netscape for the current release

if [ $RELEASE = "5.8" ];then
  NSCP_LOC=/usr/dt/appconfig/netscape
else
  NSCP_LOC=/opt/NSCPnav
fi
NSCP_EXE=netscape
NSCP_OPTIONS="-no-about-splash -iconic"

MOZILLA_HOME=$NSCP_LOC
THREADS_FLAG=native
#JMFHOME=/webstart/kiosk
#LD_LIBRARY_PATH=/usr/openwin/lib:$JMFHOME/jmflib
#CLASSPATH=.:$HOME/.netscape/java/javaplugin.jar:$JMFHOME/jmflib/jmf.jar:/webstart/kiosk/classes
CLASSPATH=.:/webstart/kiosk/classes

export LD_LIBRARY_PATH CLASSPATH MOZILLA_HOME THREADS_FLAG HOME
export JMFHOME LD_LIBRARY_PATH CLASSPATH MOZILLA_HOME THREADS_FLAG HOME

if [ ! -f /.netmnt ];then
	umount /cdrom  > /dev/null 2>&1
fi

### Beef up the ulimit
### Helps with the limitation of files (processes) open
### from within the browser
/usr/bin/ulimit -n 256

FLAGS=
if [ -f $NOWIN_FILE ];then
  FLAGS="-nodisplay"
else
  FLAGS=">> /tmp/$LOG_FILE"
fi
### Launch the sysid wizard prior to running the kiosk
cd $WIZDIR
java sysid $FLAGS 2>>/tmp/$LOG_FILE

### Start a Web Browser if we are to have a kiosk
if [ ! -f $NOWIN_FILE ];then
  	if [ -d $NSCP_LOC ];then
    		depth=`/usr/openwin/bin/xdpyinfo | awk '/depths/ {print $NF}'`
		if [ $depth -ge 8 ];then
			echo "\nStarting Netscape" >> /tmp/$LOG_FILE 2>&1
			$NSCP_LOC/$NSCP_EXE $NSCP_OPTIONS >> /tmp/$LOG_FILE 2>&1 & nspid=$!
		fi
  	fi
fi


### /usr/openwin/bin/xterm -iconic -geometry 25x10 &

### Add the swap space
echo "\nAdding local disk swap file to swap $SWAP_FILE"   >> /tmp/$LOG_FILE 2>&1

swap -a $SWAP_FILE  >> /tmp/$LOG_FILE 2>&1

/sbin/run_install
	
wait `pgrep dtwm`

echo "disk0_install complete - `date`" >> /tmp/$LOG_FILE
exit 0
