From f2c646e88e4e67683f32c6ee4ddd18915e0194c6 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 25 Jan 2022 10:17:08 -0300 Subject: Fix: provision: UEFI/BIOS cleanup --- share/hydractl/provision | 46 +++++++++++++++++++--------------------------- 1 file changed, 19 insertions(+), 27 deletions(-) (limited to 'share') diff --git a/share/hydractl/provision b/share/hydractl/provision index b5f23ce..8a15462 100755 --- a/share/hydractl/provision +++ b/share/hydractl/provision @@ -258,14 +258,16 @@ else start="$((($optimal_size + $alignment_offset) / $block_size))" optimal_sector_size="$(($optimal_size / $block_size))" - # Sector size for a 1MB partition, BIOS mode - bios_grub_size="$(($mebibyte/$block_size))" - bios_grub_end="$(($start + $bios_grub_size - 1))" - - # Sector size for a 300MB partition, UEFI mode - # See https://wiki.archlinux.org/title/Parted#UEFI/GPT_examples - uefi_grub_size="$(($mebibyte/$block_size*300))" - uefi_grub_end="$(($start + $uefi_grub_size - 1))" + if [ "$boot_mode" == "bios" ]; then + # Sector size for a 1MB partition, BIOS mode + grub_size="$(($mebibyte/$block_size))" + grub_end="$(($start + $grub_size - 1))" + else + # Sector size for a 300MB partition, UEFI mode + # See https://wiki.archlinux.org/title/Parted#UEFI/GPT_examples + grub_size="$(($mebibyte/$block_size*300))" + grub_end="$(($start + $grub_size - 1))" + fi # Regular disk partitioning. hydra_sudo_run parted -s -- $device mklabel gpt @@ -276,15 +278,15 @@ else # https://bugs.launchpad.net/ubuntu/+source/parted/+bug/1270203 # https://techtitbits.com/2018/12/using-parteds-resizepart-non-interactively-on-a-busy-partition/ # https://serverfault.com/questions/870594/resize-partition-to-maximum-using-parted-in-non-interactive-mode - #hydra_sudo_run parted -s ---pretend-input-tty -- $device mkpart non-fs ${start}s ${bios_grub_end}s Yes - #hydra_sudo_run parted $device mkpart non-fs ${start}s ${bios_grub_end}s Yes Ignore quit + #hydra_sudo_run parted -s ---pretend-input-tty -- $device mkpart non-fs ${start}s ${grub_end}s Yes + #hydra_sudo_run parted $device mkpart non-fs ${start}s ${grub_end}s Yes Ignore quit #hydra_sudo_run parted -s ---pretend-input-tty $device <