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