#!/sbin/sh
#

MYLINES="^#!Finish"
echo Finish script started on `date`

[ -z "$SI_CONFIG_DIR" ] && SI_CONFIG_DIR=/tmp/install_config
export SI_CONFIG_DIR

. $SI_CONFIG_DIR/Scripts/Misc/SetVars || exit 1
. $JSINCLUDE/Subroutines

# StartShell "Debugging from Finish/Std"
#
# If root is mirrored during Jumpstart,
# detach all submirrors except one that is in fact
# mounted as non-md device
#
# Otherwise, the machine may panic at first reboot
#
# . RootSubMirr_AttDet; RS_detach
#
# Another option is to remount root onto full mirror here
MDReMount

Chroot_Prepare

Fix_Release
#
# Install patches in 2 steps - Solaris patches BEFORE finish scripts,
# and Product-specific - AFTER finish scripts
#
/sbin/getbootargs | egrep -is nopatch && {

  echo "
  \n\n
	  ==========                                        ==========
	  ==========                WARNING:                ==========
	  ==========                                        ==========
	  ==========      'nopatch' specified at boot,      ==========
	  ==========    OS patches will not be installed    ==========
	  ==========                                        ==========
	  ==========                                        ==========
	  ==========                                        ==========
  \n\n

  "
} || apply_patches oncd Recommended Extra Platform

#
# Security cleanup must be run after OS patching,
# but before the apps installation
#
SecClean

#
# Now, run the #!Finish lines from generated Profile
#
eval "`egrep "$MYLINES" $SI_PROFILE | sed s/$MYLINES//`"

add_RootPatch # overwrite the clients root with Profiles/$SITE/SiteConfig/.
# dhcp_off
echo ===  Network statistics:  ===
netstat -in
echo =============================

RootCleanUp
echo Finish script finished on `date`

