]> git.lizzy.rs Git - plan9front.git/blob - rc/bin/inst/bootplan9
inst/partdisk: fix issue #76
[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 if(test $p9offset -gt 4128695) {        # 65536 * 63 - 10
11         echo 
12         echo 'Your Plan 9 partition is more than 2GB into your disk,'
13         echo 'and the master boot records used by Windows 9x/ME'
14         echo 'cannot access it (and thus cannot boot it).'
15         echo
16         echo 'You can install the Plan 9 master boot record, which can load'
17         echo 'partitions far into the disk.'
18         echo 
19 }
20
21 echo 'If you use the Windows NT/2000/XP master boot record'
22 echo 'or a master boot record from a Unix clone (e.g., LILO or'
23 echo 'FreeBSD bootmgr), it is probably safe to continue using'
24 echo 'that boot record rather than install the Plan 9 boot record.'
25 echo
26 prompt 'Install the Plan 9 master boot record' y n 
27 switch($rd) {
28 case n
29         ;
30 case y
31         disk/mbr -m /386/mbr /dev/$disk/data
32 }
33
34 log Setting Plan 9 partition active.
35 p9part=`{disk/fdisk /dev/$disk/data >[2]/dev/null </dev/null | 
36                 grep PLAN9 | sed 1q | sed 's/ *(p.) .*/\1/'}
37 if(~ $#p9part 0){
38         echo 'You have no Plan 9 partitions (How could this happen?)' >[1=2]
39         exit 'no plan 9 partition found'
40 }
41 p9part=$p9part(1)
42 { echo 'A '^$p9part; echo w } | disk/fdisk /dev/$disk/data >[2]/dev/null >/dev/null
43 x=$status
44 if(~ $x '' '|'){
45         echo
46         echo 'The Plan 9 partition is now marked as active.'
47         exit ''
48 }
49 exit $x