#!/sbin/sh
#
# ident	"@(#)sysconfig.sh	1.85	03/06/11 SMI"
#
# Copyright 1992-2003 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# Sun considers its source code as an unpublished, proprietary trade
# secret, and it is available only under strict license provisions.
# This copyright notice is placed here only to protect Sun in the
# event the source is deemed a published work.  Dissassembly,
# decompilation, or other means of reducing the object code to human
# readable form is prohibited by the license agreement under which
# this code is provided to the user or company in possession of this
# copy.
#
# RESTRICTED RIGHTS LEGEND: Use, duplication, or disclosure by the Government
# is subject to restrictions as set forth in subparagraph (c)(1)(ii) of the
# Rights in Technical Data and Computer Software clause at DFARS 52.227-7013
# and in similar clauses in the FAR and NASA FAR Supplement.
#
# NOTE: At this point on non-Intel systems, the locale has
#	not yet been configured
#
# NOTE:	This script may be called from outside the window
#	system (boot with "nowin" or kdmconfig/prtconf 
#	configuration failed) or within the window system
#
INSTALLBOOT=/tmp/.install_boot
PREINSTALL=/tmp/.preinstall
LOCKFILE=/tmp/.suninstall
PLATFORM=`/sbin/uname -p`

# create a lock file if one does not already exist; this is to prevent
# the suninstall script from being invoked more than once
#
si_single_lock() {
	if [ ! -f ${LOCKFILE} ]; then
		touch ${LOCKFILE}
	fi
}

# remove the suninstall lock if it exists.
#
si_single_unlock() {
	rm -f ${LOCKFILE}
}


#################################
#################################
# Main Script Body
#

echo `gettext "The system is coming up.  Please wait."`

# lock the startup process silently
#
si_single_lock


# If we are running in the window system with a non-default message
# locale, update the twm workspace menu.
#
if [ -n "${DISPLAY}" -a "${LC_MESSAGES}" -a "${LC_MESSAGES}" != "C" ]; then
	LANG_DIR="/usr/lib/locale/${LC_MESSAGES}/LC_MESSAGES"
	if [ -f ${LANG_DIR}/install_twmrc ]; then
		cp ${LANG_DIR}/install_twmrc \
			/tmp/root/.twmrc 2>/dev/console
	fi
fi

echo `gettext "Begin system identification..."`

#
# Run the sysid programs
#

SYSIDTOOL="/sbin/sysidtool"
if [ -n "${DISPLAY}" ]; then
   if [ "$XTF" ]; then
      xterm -fn "$XTF" -geometry 80x24+200+200 -cu -wf -e ${SYSIDTOOL}
   else
      xterm -geometry 80x24+200+200 -cu -wf -e ${SYSIDTOOL}
   fi
else
        eval "${SYSIDTOOL}"
fi

echo `gettext "System identification complete."`

#
# Source in any new TZ settings and export them
#
TZ=""
. /etc/default/init
export TZ

#***** S72inetsvc
# 
# This is third phase of TCP/IP startup/configuration.  This script
# runs after the NIS/NIS+ startup script.  We run things here that may
# depend on NIS/NIS+ maps.
#

# 
# Re-set the netmask and broadcast addr for all non-DHCP IP interfaces.  This
# ifconfig is run here, after NIS has been started, so that "netmask
# +" will find the netmask if it lives in a NIS map.
#

/usr/sbin/ifconfig -auD netmask + broadcast + > /dev/null


# exiting the sysconfig state so remove the lock file
si_single_unlock

#
# if we have valid media mounted,
# create the clustertoc to be used by the installation process
#
if [ -f /cdrom/.cdtoc -a -x /usr/sbin/install.d/parse_dynamic_clustertoc ]; then
	echo `gettext "Generating software table of contents [this may take a few minutes...]"`
	/usr/sbin/install.d/parse_dynamic_clustertoc	
	echo `gettext "Table of contents complete."`
fi

exec /sbin/suninstall
