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