]> git.lizzy.rs Git - plan9front.git/blob - rc/bin/inst/bootplan9
/lib/rob: Just write the code.
[plan9front.git] / rc / bin / inst / bootplan9
1 #!/bin/rc
2
3 p9offset=`{grep '^part 9fat ' /dev/$disk/ctl |awk '{print $3}'}
4 if(! ~ $#p9offset 1) {
5         echo 'could not find plan 9 partition.'
6         echo 'cannot happen'
7         exit bad
8 }
9
10 echo
11 echo 'If you use the Windows NT/2000/XP master boot record'
12 echo 'or a master boot record from a Unix clone (e.g., LILO or'
13 echo 'FreeBSD bootmgr), it is probably safe to continue using'
14 echo 'that boot record rather than install the Plan 9 boot record.'
15 echo
16 prompt 'Install the Plan 9 master boot record' y n 
17 switch($rd) {
18 case n
19         ;
20 case y
21         disk/mbr -m /386/mbr /dev/$disk/data
22 }
23
24 prompt 'Mark the Plan 9 partition active' y n
25 switch($rd) {
26 case n
27         ;
28 case y
29         p9part=`{disk/fdisk /dev/$disk/data >[2]/dev/null </dev/null | 
30                 grep PLAN9 | sed 1q | sed 's/ *(p.) .*/\1/'}
31         if(~ $#p9part 0){
32                 echo 'You have no Plan 9 partitions (How could this happen?)' >[1=2]
33                 exit 'no plan 9 partition found'
34         }
35         p9part=$p9part(1)
36         { echo 'A '^$p9part; echo w } | disk/fdisk /dev/$disk/data >[2]/dev/null >/dev/null
37         x=$status
38         if(~ $x '' '|'){
39                 echo
40                 echo 'The Plan 9 partition is now marked as active.'
41                 exit ''
42         }
43         exit $x
44 }
45 exit ''