plan9fox/rc/bin/inst/bootplan9
cinap_lenrek 52c6b751c0 inst/bootplan9: skip mbr installation and active partition switching when we have no plan9 dos partition
on efi systems, there is no plan9 partition in the dos partition table
that could be marked active and the mbr should be left alone.
2015-05-31 16:41:46 +02:00

38 lines
909 B
Bash
Executable file

#!/bin/rc
# 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 ''
}
echo
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
prompt 'Install the Plan 9 master boot record' y n
switch($rd) {
case n
;
case y
disk/mbr -m /386/mbr /dev/$disk/data
}
prompt 'Mark the Plan 9 partition active' y n
switch($rd) {
case n
;
case y
{ 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
}
exit ''