1 # 2 # ident "%Z%%M% %I% %E% SMI" 3 # 4 # Copyright 2005 Sun Microsystems, Inc. All rights reserved. 5 # Use is subject to license terms. 6 # 7 # CDDL HEADER START 8 # 9 # The contents of this file are subject to the terms of the 10 # Common Development and Distribution License, Version 1.0 only 11 # (the "License"). You may not use this file except in compliance 12 # with the License. 13 # 14 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 15 # or http://www.opensolaris.org/os/licensing. 16 # See the License for the specific language governing permissions 17 # and limitations under the License. 18 # 19 # When distributing Covered Code, include this CDDL HEADER in each 20 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. 21 # If applicable, add the following below this CDDL HEADER, with the 22 # fields enclosed by brackets "[]" replaced with your own identifying 23 # information: Portions Copyright [yyyy] [name of copyright owner] 24 # 25 # CDDL HEADER END 26 # 27 # initial properties, set during installation 28 # NOTICE: bootpath and boot-args should be set by this point. 29 #================================================================ 30 getprop bootpath bp 31 getprop boot-args bootargs 32 if .streq ( "${bootargs}"X , kernel/unixX ) 33 set bootargs 34 endif 35 36 set ba0 bogus_response 37 set cmd_err 0 38 39 # display current defaults 40 echo " <<< Current Boot Parameters >>> 41 Boot path: ${bp} 42 Boot args: ${bootargs}" 43 44 #comment out following line if auto booting is not desired 45 set boot_timeout 5 46 47 # display initial boot prompt 48 echo ' 49 Type b [file-name] [boot-flags] <ENTER> to boot with options 50 or i <ENTER> to enter boot interpreter 51 or <ENTER> to boot with defaults' 52 53 if ! .streq ( ${boot_timeout}X , X ) 54 echo " 55 <<< timeout in ${boot_timeout} seconds >>>" 56 endif 57 58 echo -n ' 59 Select (b)oot or (i)nterpreter: ' 60 61 # read response to boot prompt 62 if .streq ( ${boot_timeout}X , X ) 63 read ba0 ba1 ba2 ba3 ba4 ba5 ba6 ba7 ba8 64 else 65 readt ${boot_timeout} ba0 ba1 ba2 ba3 ba4 ba5 ba6 ba7 ba8 66 endif 67 68 # process response to boot prompt 69 # i command 70 if .streq ( ${ba0}X , iX ) 71 echo 'Entering boot interpreter - type ctrl-d to resume boot' 72 console 73 if .streq ( ${bootfile}X , X ) # if bootfile not set 74 set bootfile $def_bootfile # set to default 75 endif 76 77 # b command 78 elseif .streq ( ${ba0}X , bX ) || .streq ( ${ba0}X , bootX ) 79 if .strneq ( ${ba1}X , \\- , 1 ) # if first arg is a flag 80 # save it in bootargs 81 set bootargs "$ba1 $ba2 $ba3 $ba4 $ba5 $ba6 $ba7 $ba8" 82 set bootfile $def_bootfile # set default boot file 83 elseif ! .streq ( ${ba1}X , X ) # else if first arg is present 84 set bootfile $ba1 # set bootfile to it 85 set bootargs "$ba2 $ba3 $ba4 $ba5 $ba6 $ba7 $ba8" 86 else # else 87 set bootfile $def_bootfile # set default boot file 88 endif 89 setprop boot-args "$bootargs" 90 91 # anything else 92 else # no command 93 if ! .streq ( ${ba0}X , X ) 94 echo "invalid response: \"${ba0}\"" 95 set cmd_err 1 # user entered invalid response 96 endif 97 if .streq ( ${bootfile}X , X ) # if bootfile not set 98 set bootfile $def_bootfile # set to default 99 endif 100 endif 101 102 # other stuff 103 104 setprop whoami $bootfile 105 106 # 'b', 'i', or <ENTER> are the only valid responses 107 if ( ${cmd_err} == 1 ) 108 source /etc/bootrc 109 else 110 run $bootfile 111 echo "could not run ${bootfile}" 112 set bootfile 113 source /etc/bootrc 114 endif