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#================================================================ 30getprop bootpath bp 31getprop boot-args bootargs 32if .streq ( "${bootargs}"X , kernel/unixX ) 33 set bootargs 34endif 35 36set ba0 bogus_response 37set cmd_err 0 38 39# display current defaults 40echo " <<< Current Boot Parameters >>> 41Boot path: ${bp} 42Boot args: ${bootargs}" 43 44#comment out following line if auto booting is not desired 45set boot_timeout 5 46 47# display initial boot prompt 48echo ' 49Type b [file-name] [boot-flags] <ENTER> to boot with options 50or i <ENTER> to enter boot interpreter 51or <ENTER> to boot with defaults' 52 53if ! .streq ( ${boot_timeout}X , X ) 54 echo " 55 <<< timeout in ${boot_timeout} seconds >>>" 56endif 57 58echo -n ' 59Select (b)oot or (i)nterpreter: ' 60 61# read response to boot prompt 62if .streq ( ${boot_timeout}X , X ) 63 read ba0 ba1 ba2 ba3 ba4 ba5 ba6 ba7 ba8 64else 65 readt ${boot_timeout} ba0 ba1 ba2 ba3 ba4 ba5 ba6 ba7 ba8 66endif 67 68# process response to boot prompt 69# i command 70if .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 78elseif .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 92else # 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 100endif 101 102# other stuff 103 104setprop whoami $bootfile 105 106# 'b', 'i', or <ENTER> are the only valid responses 107if ( ${cmd_err} == 1 ) 108 source /etc/bootrc 109else 110 run $bootfile 111 echo "could not run ${bootfile}" 112 set bootfile 113 source /etc/bootrc 114endif 115