]> git.lizzy.rs Git - plan9front.git/blob - rc/bin/inst/bootsetup
ask for nvram and 9fat partitions
[plan9front.git] / rc / bin / inst / bootsetup
1 #!/bin/rc
2
3 # desc: create a boot floppy or configure hard disk to boot plan 9
4 # prereq: systype copydist
5
6 fats=(/dev/sd*/9fat)
7
8 switch($1) {
9 case checkdone checkready
10         if(~ $#fats 0 || ~ $#9fat 1 && ~ `{fstype $9fat} dos && ~ $didbootsetup 1)
11                 bootsetup=done
12         if not
13                 bootsetup=ready
14         export bootsetup
15
16 case go
17         echo
18         echo 'Setup Plan 9 FAT boot partition (9fat)'
19         echo
20
21         if(~ $#fats 1)
22                 default=(-d $fats)
23         if not
24                 default=()
25         prompt $default 'Plan 9 FAT partition' $fats
26         9fat=$rd
27         export 9fat
28         
29         if(! test -f /tmp/plan9.ini) {
30                 if(~ $syst cpu)
31                         bootfile=9pccpuf
32                 if not
33                         bootfile=9pcf
34                 {
35                         echo 'bootfile='^$bootfile
36                         echo 'bootargs=local!'^$fs
37                         if(~ $#nvram 1)
38                                 echo 'nvram='^$nvram
39                         echo 'mouseport='^$mouseport
40                         echo 'monitor='^$monitor
41                         echo 'vgasize='^$vgasize
42                         if(test -f '#ec/*nomp')
43                                 echo '*nomp=1'
44                 } >/tmp/plan9.ini
45         }
46
47         need9fatformat=no
48         if(! ~ `{fstype $9fat} dos)
49                 need9fatformat=yes
50         if(! test -f /srv/dos)
51                 dossrv
52         if(! mount -c /srv/dos /n/9fat $9fat >[2]/dev/null)
53                 need9fatformat=yes
54         if not if(! test -f /n/9fat/plan9.ini)
55                 need9fatformat=yes
56
57         if(~ $need9fatformat yes){
58                 log Initializing Plan 9 FAT partition.
59                 disk/format -r 2 -d -b /386/pbs $9fat
60                 mount -c /srv/dos /n/9fat $9fat
61         }
62         logprog rm -f /n/9fat/^(9bootfat plan9.ini 9pcf 9pccpuf)
63         logprog cp /n/newfs/386/9bootfat /n/9fat/9bootfat
64         # make file continous on disk
65         logprog chmod +al /n/9fat/9bootfat
66         logprog cp /tmp/plan9.ini /n/9fat/plan9.ini
67         logprog cp /n/newfs/386/9pcf /n/9fat/9pcf
68         logprog cp /n/newfs/386/9pccpuf /n/9fat/9pccpuf
69
70         echo
71         echo 'There are myriad ways to boot a Plan 9 system.'
72         echo 'You can use any of the following.'
73         echo
74         echo '  plan9  - make the plan 9 disk partition the default for booting'
75         echo '  winnt  - add a plan 9 option to windows nt/2000/xp boot manager'
76         echo
77         echo 'If you are upgrading an extant third edition installation and booting'
78         echo 'from something other than a floppy, you needn''t run anything here.'
79         echo 'Just type ctl-d.'
80
81         oldbootsetup=$didbootsetup
82         didbootsetup=1
83         export didbootsetup
84         prompt 'Enable boot method' plan9 winnt
85         
86         if(! boot$rd){
87                 didbootsetup=$oldbootsetup
88                 export didbootsetup
89         }
90 }