#!/bin/ksh
#
# Andrei.Ryjov@spasu.net Fri Oct 27 10:47:19 MEST 2006
#
# Install and configure Sun Cluster (SC 3.1u4) from Jumpstart
# Most of SC_ variables should have been defined in
# by SetSunClusterEnv() in Scripts/Misc/!Includes/Subroutines
#
[ -z "$SID" ] && SID=/tmp/install_config
[ X$SubrIsRead = XYes ] || . $SID/Scripts/Misc/!Includes/Subroutines
[ X$VarsAreSet = XYes ] || SetJVars
SetRootOpts ; [ X$ROOT != X/ ] && exec Chroot_Script $0 $*

echo "\n\n\t===== Installing Sun Cluster - in the chroot'ed environment =====\n"

SC_Append_Hosts

cd $SC_AUTOINSTALL_TOOLSDIR/. || StartShell "No cluster install dir"
echo Installing SunCluster prerequisite packages

PKGLIST="
  SUNWj5rt
  SUNWjdmk-runtime
  SUNWjdmk-runtime-jmx
  SUNWmconr
  SUNWcacaocfg
  SUNWcacao
"

MakeAdminFile

for PKG in $PKGLIST; do
  PKG_PARENT_DIR=`find $SC_PATH_TO_CD -type d -name $PKG | awk '/Solaris_'$TMINOR'\/Packages|shared_components\/Packages/' | sed s:/$PKG$:: | head -1`
  [ x$PKG_PARENT_DIR = x ] && StartShell "No $PKG found under $SC_PATH_TO_CD"
  pkgadd -nM -a $PKGADMIN_FILE $ROOTOPTS -d $PKG_PARENT_DIR $PKG 2>&1 | grep "Installation of"
done
set +x
mount -o rw,remount /globaldevices

#
# Go get it...
# The secondary will hang here, waiting for sponsoring node
# to come up
#
eval `echo $SC_CONFIG_LINE`
#
# StartShell "Debugging"
#
