plan9front/rc/bin/inst/bootsetup

97 lines
2.2 KiB
Plaintext
Raw Normal View History

#!/bin/rc
# desc: create a boot floppy or configure hard disk to boot plan 9
# prereq: systype copydist
2011-06-09 13:43:04 -07:00
fats=()
for(i in /dev/sd*/9fat){
if(test -f $i)
fats=($fats $i)
}
2011-06-09 13:31:04 -07:00
switch($1) {
2011-06-09 13:31:04 -07:00
case checkdone checkready
if(~ $#fats 0 || ~ $#9fat 1 && ~ `{fstype $9fat} dos && ~ $didbootsetup 1)
bootsetup=done
if not
bootsetup=ready
export bootsetup
case go
echo
2011-06-09 13:31:04 -07:00
echo 'Setup Plan 9 FAT boot partition (9fat)'
echo
2011-06-09 13:31:04 -07:00
if(~ $#fats 1)
default=(-d $fats)
if not
default=()
prompt $default 'Plan 9 FAT partition' $fats
9fat=$rd
export 9fat
2011-06-09 14:14:14 -07:00
if(! test -f /tmp/plan9.ini) {
if(~ $syst cpu)
bootfile=9pccpuf
if not
bootfile=9pcf
{
echo 'bootfile='^$bootfile
2011-04-21 17:50:41 -07:00
echo 'bootargs=local!'^$fs
2011-06-09 13:31:04 -07:00
if(~ $#nvram 1)
echo 'nvram='^$nvram
echo 'mouseport='^$mouseport
echo 'monitor='^$monitor
echo 'vgasize='^$vgasize
if(test -f '#ec/*nomp')
echo '*nomp=1'
} >/tmp/plan9.ini
}
need9fatformat=no
2011-06-09 13:31:04 -07:00
if(! ~ `{fstype $9fat} dos)
need9fatformat=yes
2011-04-21 17:50:41 -07:00
if(! test -f /srv/dos)
dossrv
2011-06-09 13:31:04 -07:00
if(! mount -c /srv/dos /n/9fat $9fat >[2]/dev/null)
need9fatformat=yes
if not if(! test -f /n/9fat/plan9.ini)
need9fatformat=yes
if(~ $need9fatformat yes){
log Initializing Plan 9 FAT partition.
2011-06-09 13:31:04 -07:00
disk/format -r 2 -d -b /386/pbs $9fat
mount -c /srv/dos /n/9fat $9fat
}
logprog rm -f /n/9fat/^(9bootfat plan9.ini 9pcf 9pccpuf)
2011-04-21 17:50:41 -07:00
logprog cp /n/newfs/386/9bootfat /n/9fat/9bootfat
2011-06-04 14:35:28 -07:00
# make file continous on disk
logprog chmod +al /n/9fat/9bootfat
logprog cp /tmp/plan9.ini /n/9fat/plan9.ini
2011-04-21 17:50:41 -07:00
logprog cp /n/newfs/386/9pcf /n/9fat/9pcf
logprog cp /n/newfs/386/9pccpuf /n/9fat/9pccpuf
echo
echo 'There are myriad ways to boot a Plan 9 system.'
echo 'You can use any of the following.'
echo
echo ' plan9 - make the plan 9 disk partition the default for booting'
echo ' winnt - add a plan 9 option to windows nt/2000/xp boot manager'
echo
echo 'If you are upgrading an extant third edition installation and booting'
echo 'from something other than a floppy, you needn''t run anything here.'
echo 'Just type ctl-d.'
oldbootsetup=$didbootsetup
didbootsetup=1
export didbootsetup
2011-06-09 14:14:14 -07:00
2011-04-12 09:32:51 -07:00
prompt 'Enable boot method' plan9 winnt
2011-06-09 14:14:14 -07:00
disk=`{basename -d $9fat}
if(! boot$rd){
didbootsetup=$oldbootsetup
export didbootsetup
}
}