2011-03-30 13:53:33 +00:00
|
|
|
#!/bin/rc
|
|
|
|
|
2015-06-06 00:00:51 +00:00
|
|
|
# look for esp and format it when not already done
|
|
|
|
esp=`{ls /dev/$disk/esp >[2]/dev/null}
|
2017-01-23 13:37:02 +00:00
|
|
|
if(~ $#esp 1 && ! ~ `{fstype $esp} dos){
|
2015-06-06 00:00:51 +00:00
|
|
|
echo
|
|
|
|
echo 'Here appears to be a unformated EFI system partition:'
|
|
|
|
echo ' ' $esp
|
|
|
|
echo
|
|
|
|
prompt 'Initialize FAT on EFI system partition' yes no
|
|
|
|
switch($rd) {
|
|
|
|
case yes
|
|
|
|
# 4k clusters to force FAT32
|
|
|
|
disk/format -d -c 8 -l ESP $esp
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-31 14:41:46 +00:00
|
|
|
# look for plan9 partition in the DOS partition table (if any)
|
|
|
|
p9part=`{disk/fdisk /dev/$disk/data >[2]/dev/null </dev/null | grep PLAN9 | sed 1q | sed 's/ *(p.) .*/\1/'}
|
|
|
|
if(~ $#p9part 0){
|
|
|
|
# nothing can be done
|
|
|
|
exit ''
|
2011-03-30 13:53:33 +00:00
|
|
|
}
|
|
|
|
|
2012-12-06 06:09:16 +00:00
|
|
|
echo
|
2011-03-30 13:53:33 +00:00
|
|
|
echo 'If you use the Windows NT/2000/XP master boot record'
|
|
|
|
echo 'or a master boot record from a Unix clone (e.g., LILO or'
|
|
|
|
echo 'FreeBSD bootmgr), it is probably safe to continue using'
|
|
|
|
echo 'that boot record rather than install the Plan 9 boot record.'
|
|
|
|
echo
|
2015-06-06 00:00:51 +00:00
|
|
|
prompt 'Install the Plan 9 master boot record' yes no
|
2011-03-30 13:53:33 +00:00
|
|
|
switch($rd) {
|
2015-06-06 00:00:51 +00:00
|
|
|
case yes
|
2011-03-30 13:53:33 +00:00
|
|
|
disk/mbr -m /386/mbr /dev/$disk/data
|
|
|
|
}
|
|
|
|
|
2015-06-06 00:00:51 +00:00
|
|
|
prompt 'Mark the Plan 9 partition active' yes no
|
2012-12-06 05:35:36 +00:00
|
|
|
switch($rd) {
|
2015-06-06 00:00:51 +00:00
|
|
|
case yes
|
2012-12-06 05:35:36 +00:00
|
|
|
{ echo 'A '^$p9part; echo w } | disk/fdisk /dev/$disk/data >[2]/dev/null >/dev/null
|
|
|
|
x=$status
|
|
|
|
if(~ $x '' '|'){
|
|
|
|
echo
|
|
|
|
echo 'The Plan 9 partition is now marked as active.'
|
|
|
|
exit ''
|
|
|
|
}
|
|
|
|
exit $x
|
2011-03-30 13:53:33 +00:00
|
|
|
}
|
2012-12-06 05:35:36 +00:00
|
|
|
exit ''
|