diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-06-06 02:00:51 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-06-06 02:00:51 +0200 |
commit | 628611fb5c701365c3b2fcbf705448a1af635cc7 (patch) | |
tree | 36a97c5550f15776c8ba07c20a0d0250ee1534b4 /rc/bin/inst/bootplan9 | |
parent | 1613fd9f526dc5a5703bbeb1d84e59980db0845e (diff) |
inst: provide gpt/mbr choice when disk is blank, format esp
Diffstat (limited to 'rc/bin/inst/bootplan9')
-rwxr-xr-x | rc/bin/inst/bootplan9 | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/rc/bin/inst/bootplan9 b/rc/bin/inst/bootplan9 index c7eb185b4..702d5d5a6 100755 --- a/rc/bin/inst/bootplan9 +++ b/rc/bin/inst/bootplan9 @@ -1,5 +1,20 @@ #!/bin/rc +# look for esp and format it when not already done +esp=`{ls /dev/$disk/esp >[2]/dev/null} +if(~ $#esp 1 && ! ~ fstype $esp dos){ + 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 + } +} + # 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){ @@ -13,19 +28,15 @@ 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 +prompt 'Install the Plan 9 master boot record' yes no switch($rd) { -case n - ; -case y +case yes disk/mbr -m /386/mbr /dev/$disk/data } -prompt 'Mark the Plan 9 partition active' y n +prompt 'Mark the Plan 9 partition active' yes no switch($rd) { -case n - ; -case y +case yes { echo 'A '^$p9part; echo w } | disk/fdisk /dev/$disk/data >[2]/dev/null >/dev/null x=$status if(~ $x '' '|'){ |