Home | History | Annotate | Download | only in svc
      1 #!/sbin/sh
      2 #
      3 # CDDL HEADER START
      4 #
      5 # The contents of this file are subject to the terms of the
      6 # Common Development and Distribution License (the "License").
      7 # You may not use this file except in compliance with the License.
      8 #
      9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
     10 # or http://www.opensolaris.org/os/licensing.
     11 # See the License for the specific language governing permissions
     12 # and limitations under the License.
     13 #
     14 # When distributing Covered Code, include this CDDL HEADER in each
     15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     16 # If applicable, add the following below this CDDL HEADER, with the
     17 # fields enclosed by brackets "[]" replaced with your own identifying
     18 # information: Portions Copyright [yyyy] [name of copyright owner]
     19 #
     20 # CDDL HEADER END
     21 #
     22 #
     23 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
     24 # Use is subject to license terms.
     25 #
     26 #
     27 # Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
     28 # All rights reserved.
     29 #
     30 
     31 # Make sure that the libraries essential to this stage of booting can be found.
     32 LD_LIBRARY_PATH=/lib; export LD_LIBRARY_PATH
     33 
     34 #
     35 # Set flags to indicate whether we are in LiveCD or AI environment
     36 #
     37 LIVECD=0
     38 AUTOINSTALL=0
     39 MOUNTED=0
     40 [ -f /.livecd ] && LIVECD=1
     41 [ -f /.autoinstall ] && AUTOINSTALL=1
     42 
     43 PRTCONF=/usr/sbin/prtconf
     44 SED=/usr/bin/sed
     45 CUT=/usr/bin/cut
     46 GREP=/usr/bin/grep
     47 MKDIR=/usr/bin/mkdir
     48 MOUNT=/sbin/mount
     49 
     50 # Sparc installation configuration
     51 INSTALL_CONF_FILE="install.conf"
     52 INSTALL_CONF_SPEC="/tmp/$INSTALL_CONF_FILE"
     53 NETBOOT="/etc/netboot"
     54 WANBOOT_CONF="$NETBOOT/wanboot.conf"
     55 
     56 # compressed archives
     57 SOLARIS_ZLIB="solaris.zlib"
     58 SOLARISMISC_ZLIB="solarismisc.zlib"
     59 
     60 libc_mount() {
     61 	#
     62 	# If there is an optimized libc available in /usr that fits this
     63 	# processor, mount it on top of the base libc.
     64 	#
     65 	MOE=`/usr/bin/moe -32 '/usr/lib/libc/$HWCAP'`
     66 	if [ -n "$MOE" ]; then
     67 		/usr/sbin/mount | egrep -s "^/lib/libc.so.1 on "
     68 		if [ $? -ne 0 ]; then
     69 			/usr/sbin/mount -O -F lofs $MOE /lib/libc.so.1
     70 		fi
     71 	fi
     72 }
     73 
     74 # This mount function is sun4v only. It may be melded with the sun4u-us3
     75 # version later.
     76 sun4v_libc_psr_mount() {
     77 	LIBC_MOE_32=`/usr/bin/moe -32 /platform/$PLAT/lib/libc_psr/'$HWCAP'`
     78 	if [ -n "$LIBC_MOE_32" ]; then
     79 		/usr/sbin/mount |
     80 		    egrep -s "^/platform/[^/]*/lib/libc_psr.so.1 on "
     81 		if [ $? -ne 0 ]; then
     82 			/usr/sbin/mount -O -F lofs $LIBC_MOE_32 \
     83 			    /platform/$PLAT/lib/libc_psr.so.1
     84 		fi
     85 	fi
     86 
     87 	LIBC_MOE_64=`/usr/bin/moe -64 \
     88 	    /platform/$PLAT/lib/sparcv9/libc_psr/'$HWCAP'`
     89 	if [ -n "$LIBC_MOE_64" ]; then
     90 		/usr/sbin/mount |
     91 		    egrep -s "^/platform/[^/]*/lib/sparcv9/libc_psr.so.1 on "
     92 		if [ $? -ne 0 ]; then
     93 			/usr/sbin/mount -O -F lofs $LIBC_MOE_64 \
     94 			    /platform/$PLAT/lib/sparcv9/libc_psr.so.1
     95 		fi
     96 	fi
     97 }
     98 
     99 # This is specific to sun4u[-us3].
    100 # try to intelligently handle the various ways that a hwcap library can
    101 # be present for libc_psr for sun4u.
    102 sun4u_libc_psr_mount() {
    103 	# first look for $PLAT specific
    104 	# the string $HWCAP is not an env var but part of the argument to moe
    105 	LIBC_MOE_32=`/usr/bin/moe -32 /platform/$PLAT/lib/libc_psr/'$HWCAP'`
    106 	if [ -n "$LIBC_MOE_32" ]; then
    107 		/usr/sbin/mount |
    108 		    egrep -s "^/platform/$PLAT/lib/libc_psr.so.1 on "
    109 		if [ $? -ne 0 ]; then
    110 			/usr/sbin/mount -O -F lofs $LIBC_MOE_32 \
    111 			    /platform/$PLAT/lib/libc_psr.so.1
    112 		fi
    113 	else
    114 		# try the 'generic' one under $ARCH
    115 		LIBC_MOE_32=`/usr/bin/moe -32 \
    116 		    /platform/$ARCH/lib/libc_psr/'$HWCAP'`
    117 		if [ -n "$LIBC_MOE_32" ]; then
    118 			/usr/sbin/mount |
    119 			    egrep -s "^/platform/$ARCH/lib/libc_psr.so.1 on "
    120 			if [ $? -ne 0 ]; then
    121 				/usr/sbin/mount -O -F lofs $LIBC_MOE_32 \
    122 				    /platform/$ARCH/lib/libc_psr.so.1
    123 			fi
    124 		fi
    125 
    126 	fi
    127 
    128 	# now repeat for 64 bit.
    129 
    130 	LIBC_MOE_64=`/usr/bin/moe -64 \
    131 	    /platform/$PLAT/lib/sparcv9/libc_psr/'$HWCAP'`
    132 	if [ -n "$LIBC_MOE_64" ]; then
    133 		/usr/sbin/mount |
    134 		    egrep -s "^/platform/$PLAT/lib/sparcv9/libc_psr.so.1 on "
    135 		if [ $? -ne 0 ]; then
    136 			/usr/sbin/mount -O -F lofs $LIBC_MOE_64 \
    137 			    /platform/$PLAT/lib/sparcv9/libc_psr.so.1
    138 		fi
    139 	else
    140 		# now try $ARCH version
    141 		LIBC_MOE_64=`/usr/bin/moe -64 \
    142 		    /platform/$ARCH/lib/sparcv9/libc_psr/'$HWCAP'`
    143 		if [ -n "$LIBC_MOE_64" ]; then
    144 			/usr/sbin/mount |
    145 			    egrep -s \
    146 			    "^/platform/$ARCH/lib/sparcv9/libc_psr.so.1 on "
    147 			if [ $? -ne 0 ]; then
    148 				/usr/sbin/mount -O -F lofs $LIBC_MOE_64 \
    149 				    /platform/$ARCH/lib/sparcv9/libc_psr.so.1
    150 			fi
    151 		fi
    152 	fi
    153 }
    154 
    155 #
    156 # Most of the operations in this script are only necessary in the global
    157 # zone but due to the way initialization scripts like this are packaged,
    158 # it needs to currently exist for all zones.
    159 #
    160 if [ "${_INIT_ZONENAME:=`/sbin/zonename`}" != "global" ]; then
    161 	libc_mount
    162 	exit 0
    163 fi
    164 
    165 . /lib/svc/share/smf_include.sh
    166 . /lib/svc/share/fs_include.sh
    167 
    168 
    169 if [ $LIVECD = 1 -o $AUTOINSTALL = 1 ]; then
    170 	#
    171 	# Remount root RW
    172 	#
    173 	echo "\rRemounting root read/write" > /dev/msglog
    174 	ISA_INFO=`/sbin/uname -p`
    175 	if [ $ISA_INFO = "sparc" ]
    176 	then
    177 		# ramdisk is differently labeled in sparc vs x86
    178 		/sbin/mount -o remount,rw /devices/ramdisk-root:a /
    179 	else
    180 		# x86 label
    181 		/sbin/mount -o remount,rw /devices/ramdisk:a /
    182 	fi
    183 
    184 
    185 	#
    186 	# Workaround for devfs lazy init. The sd nodes are not
    187 	# created till you try to access them.
    188 	#
    189 	echo "Probing for device nodes ..." > /dev/msglog
    190 
    191 	ls -lR /devices/* > /dev/null
    192 fi
    193 
    194 if [ $LIVECD = 1 ]; then
    195 	volumeid=`cat /.volumeid`
    196 
    197 	echo "\rPreparing live image for use" >/dev/msglog
    198 
    199 	# Determine if any of the USB devices contains a UFS filesystem.
    200 	# For devices that do, attempt to mount them to see if the 
    201 	# compressed /usr filesystem exists
    202 
    203 	/sbin/listusb | while read dev rdev
    204 	do
    205 		/usr/lib/fs/ufs/fstyp $rdev 2>&1 | grep "^ufs$"
    206 		if [ $? -eq 0 ]
    207 		then
    208 			/sbin/mount -F ufs -o nologging,noatime $dev /.cdrom || break
    209 			if [ -f /.cdrom/$SOLARIS_ZLIB ]
    210 			then
    211 				echo "" > /.liveusb
    212 				break
    213 			else
    214 				/sbin/umount -f $dev
    215 				continue
    216 			fi
    217 		fi
    218 	done
    219 
    220 	# ..Else look for CD
    221 	[ ! -f /.liveusb ] && /sbin/listcd | while read dev rdev
    222 	do
    223 		/usr/lib/fs/hsfs/fstyp -v $rdev 2>&1 | grep "Volume id: $volumeid" > /dev/null
    224 		if [ $? -eq 0 ]
    225 		then
    226 			/sbin/mount -F hsfs -o ro $dev /.cdrom || break
    227 		fi
    228 	done
    229 
    230 	# Check if mount of /.cdrom failed.
    231 	/sbin/mount | grep "^/.cdrom"
    232 	if [ $? -ne 0 ]
    233 	then
    234 		echo "** FATAL **: Unable to access media"
    235 		exit $SMF_EXIT_ERR_FATAL
    236 	fi
    237 
    238 	# Explictly create lofi devices for solaris.zlib and 
    239 	# solarismisc.zlib
    240 
    241 	
    242 	#
    243 	# Can not mount solaris.zlib using just the mount command,
    244 	# because the mount command enforces nosetuid, and /usr
    245 	# needs to have the setuid capability.
    246 	#
    247 	/usr/sbin/lofiadm -a /.cdrom/$SOLARIS_ZLIB /dev/lofi/1 || break
    248 	/sbin/mount -F hsfs -o ro /dev/lofi/1 /usr
    249 	if [ $? -ne 0 ]
    250 	then
    251 		echo "/usr MOUNT FAILED!" 
    252 		exit $SMF_EXIT_ERR_FATAL
    253 	fi
    254 
    255 
    256 	/sbin/mount -F hsfs -o ro /.cdrom/$SOLARISMISC_ZLIB /mnt/misc
    257 	if [ $? -ne 0 ]
    258 	then
    259 		echo "/mnt/misc MOUNT FAILED!"
    260 		exit $SMF_EXIT_ERR_FATAL
    261 	fi
    262 
    263 	MOUNTED=1
    264 	echo "Done mounting Live image" > /dev/msglog
    265 elif [ $AUTOINSTALL = 1 ]; then
    266 	echo "Preparing automated install image for use" > /dev/msglog
    267 
    268 	# Prime the network
    269 	/sbin/dhcpagent -a
    270 
    271 	#
    272 	# For SPARC mount wanbootfs which contains wanboot.conf file
    273 	# associated with this client. root_file option defined there
    274 	# points to the boot archive and has following format:
    275 	# root_file=<ai_image>/boot/platform/sun4v/boot_archive
    276 	# We need to extract <ai_image> part, since this is the
    277 	# location of solaris*.zlib archives.
    278 	#
    279 	# For X86, get the install media from the menu.lst 
    280 	#
    281 	if [ "$ISA_INFO" = "sparc" ]; then
    282 		# check if wanboot provided wanbootfs
    283 		BOOTFS_DISK="/devices/ramdisk-bootfs:a"
    284 		if [ ! -b "$BOOTFS_DISK" ] ; then
    285 			echo "Sparc wanboot configuration file is not" \
    286 			    "available" > /dev/msglog
    287 
    288 			exit $SMF_EXIT_ERR_FATAL
    289 		fi
    290 
    291 		# create mountpoint for wanbootfs
    292 		$MKDIR "$NETBOOT"
    293 
    294 		if [ $? -ne 0 ] ; then
    295 			echo "Couldn't create $NETBOOT directory" > \
    296 			    /dev/msglog
    297 
    298 			exit $SMF_EXIT_ERR_FATAL
    299 		fi
    300 
    301 		# mount wanbootfs which is hsfs(7FS) filesystem
    302 		$MOUNT -F hsfs -o ro "$BOOTFS_DISK" "$NETBOOT" > \
    303 		    /dev/msglog 2>&1
    304 
    305 		if [ $? -ne 0 ] ; then
    306 			echo "Couldn't mount wanbootfs filesystem" > \
    307 			    /dev/msglog
    308 
    309 			exit $SMF_EXIT_ERR_FATAL
    310 		fi
    311 
    312 		# check, if wanboot.conf is present
    313 		if [ ! -f $WANBOOT_CONF ] ; then
    314 			echo "$WANBOOT_CONF file not found" > /dev/msglog
    315 
    316 			exit $SMF_EXIT_ERR_FATAL
    317 		fi
    318 
    319 		# extract path to directory containing AI image
    320 		ai_image_dir=`$GREP "^root_file" $WANBOOT_CONF |
    321 		    $CUT -d '=' -f 2 | $SED -e s-boot/platform/sun4v/boot_archive--`
    322 
    323 		if [ -z "$ai_image_dir" ] ; then
    324 			echo "Couldn't obtain location of AI image" > \
    325 			    /dev/msglog
    326 
    327 			exit $SMF_EXIT_ERR_FATAL
    328 		fi
    329 
    330 		echo "The AI image will be retrieved from $ai_image_dir" \
    331 		    "directory" > /dev/msglog
    332 
    333 		#
    334 		# extract address of AI server from root_server option
    335 		# It is in following format:
    336 		# root_server=http://<ai_server>:<port>/<path_to_wanboot-cgi>
    337 		#
    338 		ai_server=`$GREP "^root_server" $WANBOOT_CONF |
    339 		    $CUT -d '=' -f 2 | $CUT -d '/' -f 1-3`
    340 
    341 		if [ -z "$ai_server" ] ; then
    342 			echo "Couldn't obtain address of AI server" > \
    343 			    /dev/msglog
    344 
    345 			exit $SMF_EXIT_ERR_FATAL
    346 		fi
    347 
    348 		MEDIA="$ai_server$ai_image_dir"
    349 	else
    350 		# Get the install media data to use in http url
    351 		MEDIA=`/usr/sbin/prtconf -v /devices | \
    352 	    	    /usr/bin/sed -n '/install_media/{;n;p;}' | \
    353 		    /usr/bin/cut -f 2 -d \'`
    354 
    355 	fi
    356 
    357 	#
    358 	# Translate to valid url - it is dummy operation for now
    359 	# since it is assumed that complete and valid URL was provided
    360 	#
    361 	url=$MEDIA
    362 	if [ -z "$url" ]
    363 	then
    364 		echo "Couldn't determine source of automated install image" > \
    365 		    /dev/msglog
    366 		exit $SMF_EXIT_ERR_FATAL
    367 	fi
    368 
    369 	# Mount /tmp to download files
    370 	/usr/lib/fs/tmpfs/mount swap /tmp
    371 	if [ $? -ne 0 ]
    372 	then
    373 		echo "Mounting swap FAILED!" > /dev/msglog
    374 		exit $SMF_EXIT_ERR_FATAL
    375 	fi
    376 
    377 	# Download compressed '/usr' and store to tmp
    378 	echo "Downloading $SOLARIS_ZLIB archive" > /dev/msglog
    379 	usr_fs="$url/$SOLARIS_ZLIB"
    380 	/usr/bin/wget $usr_fs -O /tmp/$SOLARIS_ZLIB > \
    381 	    /dev/msglog 2> /dev/msglog
    382 	if [ $? -ne 0 ]
    383 	then
    384 		echo "Could not obtain $usr_fs archive from install" \
    385 		    "server" > /dev/msglog
    386 
    387 		echo "Please verify that the install server is correctly" \
    388 		    "configured and reachable from the client" > /dev/msglog
    389 
    390 		exit $SMF_EXIT_ERR_FATAL
    391 	fi
    392 
    393 	# Download rest of AI net image and store to tmp
    394 	echo "Downloading $SOLARISMISC_ZLIB archive" > /dev/msglog
    395 	misc_fs="$url/$SOLARISMISC_ZLIB"
    396 	/usr/bin/wget $misc_fs -O /tmp/$SOLARISMISC_ZLIB > \
    397 	    /dev/msglog 2> /dev/msglog
    398 	if [ $? -ne 0 ]
    399 	then
    400 		echo "Could not obtain $misc_fs archive from" \
    401 		    "install server" > /dev/msglog
    402 
    403 		echo "Please verify that the install server is correctly" \
    404 		    "configured and reachable from the client" > /dev/msglog
    405 
    406 		exit $SMF_EXIT_ERR_FATAL
    407 	fi
    408 
    409 	# download the install.conf file to get the service name for SPARC
    410 	if [ "$ISA_INFO" = "sparc" ]; then
    411 		install_conf="$url/$INSTALL_CONF_FILE"
    412 		/usr/bin/wget $install_conf -O $INSTALL_CONF_SPEC > \
    413 		    /dev/msglog 2> /dev/msglog
    414 		if [ $? -ne 0 ]; then
    415 			echo "Could not obtain $install_conf file from" \
    416 			    "install server" > /dev/msglog
    417 
    418 			echo "Please verify that the install server is" \
    419 			    "correctly configured and reachable from" \
    420 			    "the client" > /dev/msglog
    421 
    422 			exit $SMF_EXIT_ERR_FATAL
    423 		fi
    424 	fi
    425 
    426 	# download the .image_info file for x86
    427 	if [ "$ISA_INFO" != "sparc" ]; then
    428 		img_info="$url/.image_info"
    429 		/usr/bin/wget $img_info -O /tmp/.image_info > \
    430 		    /dev/msglog 2> /dev/msglog
    431 		if [ $? -ne 0 ]; then
    432 			echo "Could not obtain $img_info file from install" \
    433 			    "server" > /dev/msglog
    434 
    435 			echo "Please verify that the install server is" \
    436 			    "correctly configured and reachable from" \
    437 			    "the client" > /dev/msglog
    438 
    439 			exit $SMF_EXIT_ERR_FATAL
    440 		fi
    441 	fi
    442 
    443 	# Lofi mount downloaded archives to /usr and /mnt/misc respectively
    444 
    445 	#
    446 	# Can not mount solaris.zlib using just the mount command,
    447 	# because the mount command enforces nosetuid, and /usr
    448 	# needs to have the setuid capability.
    449 	#
    450 	usr_lofi_dev=`/usr/sbin/lofiadm -a /tmp/solaris.zlib`
    451 	if [ $? -ne 0 -o -z "$usr_lofi_dev" ]
    452 	then
    453 		echo "Couldn't lofi mount /usr filesystem" > /dev/msglog
    454 		exit $SMF_EXIT_ERR_FATAL
    455 	fi
    456 
    457 	/sbin/mount -F hsfs -o ro $usr_lofi_dev /usr
    458 	if [ $? -ne 0 ]
    459 	then
    460 		echo "Couldn't mount /usr filesystem" > /dev/msglog
    461 		exit $SMF_EXIT_ERR_FATAL
    462 	fi
    463 
    464 	#
    465 	# As setting 'nosuid' is acceptable for /mnt/misc filesystem,
    466 	# we can take advantage of mounting that file directly and
    467 	# skipping explicit lofi mount step required for /usr
    468 	#
    469 	/sbin/mount -F hsfs /tmp/$SOLARISMISC_ZLIB /mnt/misc
    470 	if [ $? -ne 0 ]
    471 	then
    472 		echo "Couldn't mount /mnt/misc" > /dev/msglog
    473 		exit $SMF_EXIT_ERR_FATAL
    474 	fi
    475 	MOUNTED=1
    476 	echo "Done mounting automated install image" > /dev/msglog
    477 
    478 	#
    479 	# set keyboard layout to 'US-English'
    480 	# This is just an interim solution.
    481 	# For long term, keyboard layout will be defined
    482 	# in AI manifest and set in ICT phase
    483 	#
    484 	/usr/bin/kbd -s US-English
    485 
    486 	#
    487 	# If requested, enable remote access via ssh
    488 	#
    489 	if [ $ISA_INFO = "sparc" ] ; then
    490 		AI_ENABLE_SSH=`/usr/bin/grep "^livessh" $INSTALL_CONF_SPEC |
    491 		    /usr/bin/cut -d'=' -f2`
    492 	else
    493 		AI_ENABLE_SSH=`prtconf -v /devices|sed -n '/livessh/{;n;p;}' |
    494 		    cut -f 2 -d\'`
    495 	fi
    496 
    497 	if [ "$AI_ENABLE_SSH" = "enable" ]; then
    498 		# generate ssh keys
    499 		/lib/svc/method/sshd -c
    500 
    501 		# enabled ssh server
    502 		/usr/sbin/svcadm enable network/ssh
    503 	fi
    504 fi
    505 
    506 # If archives were not mounted, complain and exit
    507 if [ $MOUNTED -ne 1 ] ; then
    508 	if [ $LIVECD = 1 ] ; then
    509 		echo "** FATAL **: Unable to mount Live image!" > /dev/msglog
    510 	elif [ $AUTOINSTALL = 1 ] ; then
    511 		echo "Unable to mount the autoinstall image" > /dev/msglog
    512 	fi
    513     exit $SMF_EXIT_ERR_FATAL
    514 fi
    515 
    516 #
    517 # Root is already mounted (by the kernel), but still needs to be
    518 # checked, possibly remounted and entered into mnttab. First
    519 # mount /usr read only if it is a separate file system. This must
    520 # be done first to allow utilities such as fsck and setmnt to
    521 # reside on /usr minimizing the space required by the root file
    522 # system.
    523 #
    524 readvfstab "/usr" < $vfstab
    525 if [ -n "$mountp" ]; then
    526 	if [ "$fstype" = cachefs ]; then
    527 		#
    528 		# Mount without the cache initially.  We'll enable it
    529 		# later at remount time.  This lets us avoid
    530 		# teaching the statically linked mount program about
    531 		# cachefs.  Here we determine the backfstype.
    532 		# This is not pretty, but we have no tools for parsing
    533 		# the option string until we get /usr mounted...
    534 		#
    535 		case "$mntopts" in
    536 		*backfstype=nfs*)
    537 			cfsbacktype=nfs
    538 			;;
    539 		*backfstype=hsfs*)
    540 			cfsbacktype=hsfs
    541 			;;
    542 		*)
    543 			msg='invalid vfstab entry for /usr'
    544 			echo $msg
    545 			echo "$SMF_FMRI:" $msg >/dev/msglog
    546 			cfsbacktype=nfs
    547 			;;
    548 		esac
    549 		mountfs - /usr $cfsbacktype ro $special ||
    550 		    exit $SMF_EXIT_ERR_FATAL
    551 	else
    552 		#
    553 		# Must use -o largefiles here to ensure the
    554 		# read-only mount does not fail as a result of
    555 		# having a large file present on /usr. This gives
    556 		# fsck a chance to fix up the largefiles flag
    557 		# before we remount /usr read-write.
    558 		#
    559 		if [ "x$mntopts" = x- ]; then
    560 			mntopts='ro,largefiles'
    561 		else
    562 			checkopt largefiles $mntopts
    563 			if [ "x$option" != xlargefiles ]; then
    564 				mntopts="largefiles,$mntopts"
    565 			fi
    566 
    567 			checkopt ro $mntopts
    568 			if [ "x$option" != xro ]; then
    569 				mntopts="ro,$mntopts"
    570 			fi
    571 
    572 			#
    573 			# Requesting logging on a read-only mount
    574 			# causes errors to be displayed, so remove
    575 			# "logging" from the list of options for now.
    576 			# The read-write mount performed later will
    577 			# specify the logging option if appropriate.
    578 			#
    579 
    580 			checkopt logging $mntopts
    581 			if [ "x$option" = xlogging ]; then
    582 				mntopts="$otherops"
    583 			fi
    584 		fi
    585 
    586 		mountfs -O /usr $fstype $mntopts - || exit $SMF_EXIT_ERR_FATAL
    587 	fi
    588 fi
    589 
    590 #
    591 # Also mount /boot now so that things like keymap.sh can access
    592 # boot properties through eeprom.  Readonly isn't required because
    593 # /boot (and other pcfs filesystems) aren't fsck'ed at boot yet.
    594 # Also, we don't account for caching /boot as it must be on a local
    595 # disk.  So what's in vfstab is fine as it stands; just look to see
    596 # if it's there and avoid the mount if not.
    597 #
    598 readvfstab "/boot" < $vfstab
    599 
    600 if [ -n "$mountp" ]; then
    601 	mountfs - /boot $fstype $mntopts - || exit $SMF_EXIT_ERR_FATAL
    602 fi
    603 
    604 #
    605 # Update kernel driver.conf cache with any additional driver.conf
    606 # files found on /usr, and device permissions from /etc/minor_perm.
    607 #
    608 /usr/sbin/devfsadm -I -P
    609 
    610 [ -f /etc/.dynamic_routing ] && /usr/bin/rm -f /etc/.dynamic_routing
    611 
    612 libc_mount
    613 
    614 # 
    615 # Discover architecture and find and mount optimal libc_psr 
    616 #  
    617 PLAT=`/usr/bin/uname -i` 
    618 ARCH=`/usr/bin/uname -m` 
    619 if [ "$ARCH" = "sun4v" ]; then 
    620 	sun4v_libc_psr_mount 
    621 elif [ "$ARCH" = "sun4u" ]; then 
    622 	if [ -h /platform/$PLAT/lib/libc_psr.so.1 ]; then 
    623 		LINKSTO=`/usr/bin/ls -l /platform/$PLAT/lib/libc_psr.so.1 | 
    624 			/usr/bin/awk '{print $NF}'` 
    625 		if [ "$LINKSTO" = "../../sun4u-us3/lib/libc_psr.so.1" ]; then 
    626 			ARCH=sun4u-us3 
    627 		fi
    628 	fi
    629 	sun4u_libc_psr_mount 
    630 fi
    631 
    632 if [ $LIVECD = 1 -o $AUTOINSTALL = 1 ]
    633 then
    634 	/usr/bin/rm -f /etc/svc/repository-boot*
    635 
    636 	# Mount opt
    637 	/usr/sbin/mount -F lofs /mnt/misc/opt /opt
    638 	
    639 	#
    640 	# Update runtime linker cache
    641 	#
    642 	if [ -f /etc/crle.conf ]
    643 	then
    644 
    645 		PATH=/usr/foss/bin:/usr/foss/firefox/bin:/usr/foss/thunderbird/bin:/sbin:/usr/sbin:/usr/bin:/usr/ccs/bin:/usr/X11R6/bin:/opt/DTT/bin
    646 		export PATH
    647 
    648 		LD_LIBRARY_PATH=/usr/foss/lib:/lib:/usr/lib:/usr/sfw/lib:/usr/X11R6/lib
    649 		export LD_LIBRARY_PATH
    650 
    651 		. /etc/crle.conf
    652 		#/usr/bin/crle $CRLE_OPTS
    653 	fi
    654 fi
    655 
    656 if [ $LIVECD = 1 ]
    657 then
    658 	#
    659 	# Determine if we should beep to let users with visual
    660 	# impairments know that they are being queried for information.
    661 	#
    662 	assistive_tech=`$PRTCONF -v /devices | \
    663 	    $SED -n '/assistive_tech/{;n;p;}' | $CUT -f 2 -d\'`
    664 
    665 	#
    666 	# Ask user to configure Keyboard Layout
    667 	#
    668 	TERM=sun-color
    669 	export TERM
    670 	exec </dev/console >/dev/console 2>&1
    671 
    672 	#
    673 	# if requested via GRUB menu selection:
    674 	#     enable ssh
    675 	#     set keyboard layout to default of English
    676 	#     set desktop language to default of English
    677 	# else
    678 	#     Ask user to configure Keyboard Layout and Desktop Language
    679 	#
    680 	livessh=`prtconf -v /devices|sed -n '/livessh/{;n;p;}'|cut -f 2 -d\'`
    681 	if [ "$livessh" = "enable" ]; then
    682 		/usr/sbin/svcadm enable network/ssh
    683 		/usr/bin/kbd -s US-English
    684 		/usr/sbin/set_lang default
    685 	else
    686 		#
    687 		# Ask user to configure Keyboard Layout
    688 		#
    689 		if [ "x$assistive_tech" != "x" ] ; then
    690 			printf "\\a"
    691 		fi
    692 		/usr/bin/kbd -s
    693 
    694 		#
    695 		# Ask user to configure Language
    696 		#
    697 		if [ "x$assistive_tech" != "x" ] ; then
    698 			printf "\\a"
    699 		fi
    700 		/usr/sbin/set_lang
    701 	fi
    702 
    703 	# /usr/bin/setup.sh
    704 	livemode=`prtconf -v /devices|sed -n '/livemode/{;n;p;}'|cut -f 2 -d\'`
    705 	if [ "$livemode" = "text" ]; then
    706 		/usr/sbin/svcadm disable -t application/graphical-login/gdm
    707 	else
    708 		[ "$livemode" = "vesa" ] && cp /.cdrom/jack/xorg.conf.vesa /etc/X11/xorg.conf
    709 		/usr/sbin/svcadm enable application/graphical-login/gdm
    710 	fi
    711 
    712 fi
    713 
    714 exit 0
    715