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