]> git.lizzy.rs Git - plan9front.git/blob - rc/bin/inst/bootsetup
inst: installer adaption to cwfs
[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: copydist
5
6 switch($1) {
7 case go
8         echo
9         echo 'Initializing Plan 9 FAT configuration partition (9fat)'
10         echo
11         
12         fat=(/dev/sd*/9fat)
13         fat=$fat(1)
14         disk=`{echo $fat | sed 's:/dev/::;s:/9fat::'}
15         if(! test -f $fat) {
16                 echo 'You have no 9fat partition.  Can''t setup booting.'
17                 exit
18         }
19
20         if(! test -f /tmp/plan9.ini) {
21                 {
22                         echo bootfile'='9pcf
23                         echo 'bootargs=local!'^$fs
24                         echo 'mouseport='^$mouseport
25                         echo 'monitor='^$monitor
26                         echo 'vgasize='^$vgasize
27                 } >/tmp/plan9.ini
28         }
29         if(! test -f /tmp/plan9ini.bak)
30                 cp /tmp/plan9.ini /tmp/plan9ini.bak
31
32         need9fatformat=no
33         if(! isfat $fat)
34                 need9fatformat=yes
35         if(! test -f /srv/dos)
36                 dossrv
37         if not if(! mount -c /srv/dos /n/9fat /dev/$disk/9fat >[2]/dev/null)
38                 need9fatformat=yes
39         if not if(! test -f /n/9fat/plan9.ini)
40                 need9fatformat=yes
41
42         if(~ $need9fatformat yes){
43                 log Initializing Plan 9 FAT partition.
44                 disk/format -r 2 -d -b /386/pbs $fat /n/newfs/386/9bootfat
45                 mount -c /srv/dos /n/9fat $fat
46         }
47
48         logprog cp /tmp/plan9.ini /n/9fat/plan9.ini
49         if(test -f /tmp/plan9ini.bak)
50                 logprog cp /tmp/plan9ini.bak /n/9fat/plan9ini.bak
51         logprog cp /n/newfs/386/9bootfat /n/9fat/9bootfat
52         logprog cp /n/newfs/386/9pcf /n/9fat/9pcf
53
54         echo
55         echo 'There are myriad ways to boot a Plan 9 system.'
56         echo 'You can use any of the following.'
57         echo
58         echo '  plan9  - make the plan 9 disk partition the default for booting'
59         echo '  winnt  - add a plan 9 option to windows nt/2000/xp boot manager'
60         echo
61         echo 'If you are upgrading an extant third edition installation and booting'
62         echo 'from something other than a floppy, you needn''t run anything here.'
63         echo 'Just type ctl-d.'
64
65         oldbootsetup=$didbootsetup
66         didbootsetup=1
67         export didbootsetup
68         prompt 'Enable boot method' plan9 winnt
69         
70         if(! boot$rd){
71                 didbootsetup=$oldbootsetup
72                 export didbootsetup
73         }
74
75 case checkdone
76         xxxfat=(/dev/sd*/9fat)
77         if(! isfat $xxxfat(1) || ! ~ $didbootsetup 1){
78                 bootsetup=ready
79                 export bootsetup
80         }
81 }