]> git.lizzy.rs Git - plan9front.git/blob - rc/bin/inst/bootplan9
turn ptrdiff_t into a 64 bit type
[plan9front.git] / rc / bin / inst / bootplan9
1 #!/bin/rc
2
3 # look for esp and format it when not already done
4 esp=`{ls /dev/$disk/esp >[2]/dev/null}
5 if(~ $#esp 1 && ! ~ `{fstype $esp} dos){
6         echo
7         echo 'Here appears to be a unformated EFI system partition:'
8         echo '  ' $esp
9         echo
10         prompt 'Initialize FAT on EFI system partition' yes no
11         switch($rd) {
12         case yes
13                 # 4k clusters to force FAT32
14                 disk/format -d -c 8 -l ESP $esp
15         }
16 }
17
18 # look for plan9 partition in the DOS partition table (if any)
19 p9part=`{disk/fdisk /dev/$disk/data >[2]/dev/null </dev/null | grep PLAN9 | sed 1q | sed 's/ *(p.) .*/\1/'}
20 if(~ $#p9part 0){
21         # nothing can be done
22         exit ''
23 }
24
25 echo
26 echo 'If you use the Windows NT/2000/XP master boot record'
27 echo 'or a master boot record from a Unix clone (e.g., LILO or'
28 echo 'FreeBSD bootmgr), it is probably safe to continue using'
29 echo 'that boot record rather than install the Plan 9 boot record.'
30 echo
31 prompt 'Install the Plan 9 master boot record' yes no
32 switch($rd) {
33 case yes
34         disk/mbr -m /386/mbr /dev/$disk/data
35 }
36
37 prompt 'Mark the Plan 9 partition active' yes no
38 switch($rd) {
39 case yes
40         { echo 'A '^$p9part; echo w } | disk/fdisk /dev/$disk/data >[2]/dev/null >/dev/null
41         x=$status
42         if(~ $x '' '|'){
43                 echo
44                 echo 'The Plan 9 partition is now marked as active.'
45                 exit ''
46         }
47         exit $x
48 }
49 exit ''