2011-03-30 06:53:33 -07:00
|
|
|
#!/bin/rc
|
|
|
|
|
|
|
|
# desc: create a boot floppy or configure hard disk to boot plan 9
|
2011-05-04 11:55:08 -07:00
|
|
|
# prereq: systype copydist
|
2011-03-30 06:53:33 -07:00
|
|
|
|
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
|
|
|
|
2011-03-30 06:53:33 -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
|
|
|
|
|
2011-03-30 06:53:33 -07:00
|
|
|
case go
|
|
|
|
echo
|
2011-06-09 13:31:04 -07:00
|
|
|
echo 'Setup Plan 9 FAT boot partition (9fat)'
|
2011-03-30 06:53:33 -07:00
|
|
|
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-03-30 06:53:33 -07:00
|
|
|
if(! test -f /tmp/plan9.ini) {
|
2011-05-04 11:55:08 -07:00
|
|
|
if(~ $syst cpu)
|
|
|
|
bootfile=9pccpuf
|
|
|
|
if not
|
|
|
|
bootfile=9pcf
|
2011-03-30 06:53:33 -07:00
|
|
|
{
|
2011-05-04 11:55:08 -07:00
|
|
|
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
|
2011-03-30 06:53:33 -07:00
|
|
|
echo 'mouseport='^$mouseport
|
|
|
|
echo 'monitor='^$monitor
|
|
|
|
echo 'vgasize='^$vgasize
|
2011-05-04 23:41:01 -07:00
|
|
|
if(test -f '#ec/*nomp')
|
2011-05-09 15:56:02 -07:00
|
|
|
echo '*nomp=1'
|
2011-03-30 06:53:33 -07:00
|
|
|
} >/tmp/plan9.ini
|
|
|
|
}
|
|
|
|
|
|
|
|
need9fatformat=no
|
2011-06-09 13:31:04 -07:00
|
|
|
if(! ~ `{fstype $9fat} dos)
|
2011-03-30 06:53:33 -07:00
|
|
|
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)
|
2011-03-30 06:53:33 -07:00
|
|
|
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
|
2011-03-30 06:53:33 -07:00
|
|
|
}
|
2011-06-04 15:25:35 -07:00
|
|
|
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
|
2011-06-04 14:34:51 -07:00
|
|
|
logprog chmod +al /n/9fat/9bootfat
|
2011-06-04 15:25:35 -07:00
|
|
|
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
|
2011-05-04 11:55:08 -07:00
|
|
|
logprog cp /n/newfs/386/9pccpuf /n/9fat/9pccpuf
|
2011-03-30 06:53:33 -07:00
|
|
|
|
|
|
|
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-04-12 09:32:51 -07:00
|
|
|
prompt 'Enable boot method' plan9 winnt
|
2011-03-30 06:53:33 -07:00
|
|
|
|
|
|
|
if(! boot$rd){
|
|
|
|
didbootsetup=$oldbootsetup
|
|
|
|
export didbootsetup
|
|
|
|
}
|
|
|
|
}
|