aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2022-01-25 10:17:08 -0300
committerSilvio Rhatto <rhatto@riseup.net>2022-01-25 10:17:08 -0300
commitf2c646e88e4e67683f32c6ee4ddd18915e0194c6 (patch)
tree073d0ce5827681d242698db569be0c32c3e7847c
parent670e5f74788413597d43ddd041c4271fe419f97b (diff)
downloadhydra-f2c646e88e4e67683f32c6ee4ddd18915e0194c6.tar.gz
hydra-f2c646e88e4e67683f32c6ee4ddd18915e0194c6.tar.bz2
Fix: provision: UEFI/BIOS cleanup
-rwxr-xr-xshare/hydractl/provision46
1 files changed, 19 insertions, 27 deletions
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 <<EOF
-#mkpart non-fs ${start}s ${bios_grub_end}s
+#mkpart non-fs ${start}s ${grub_end}s
#Yes
#Ignore
#quit
#EOF
- hydra_sudo_run parted -s -- $device mkpart non-fs ${start}s ${bios_grub_end}s
+ hydra_sudo_run parted -s -- $device mkpart non-fs ${start}s ${grub_end}s
# Se GRUB flag
hydra_sudo_run parted -s -- $device set 1 bios_grub on
@@ -293,7 +295,7 @@ else
hydra_install_package dosfstools
- hydra_sudo_run parted -s -- $device mkpart fat32 ${start}s ${uefi_grub_end}s
+ hydra_sudo_run parted -s -- $device mkpart fat32 ${start}s ${grub_end}s
hydra_sudo_run parted -s -- $device set 1 esp on
hydra_sudo_run parted -s -- $device name 1 ESP
hydra_sudo_run mkfs.vfat $esp_device
@@ -305,12 +307,8 @@ else
if [ "$encrypt" == "y" ]; then
# Second partition must also be aligned by a multiple of $optimal_sector_size
# So we find the minimum optimal start sector which is after the grub partition
- if [ "$boot_mode" == "bios" ]; then
- #lvm_start="$(($bios_grub_end + 1))"
- lvm_start="`partition_sector_start $start $bios_grub_end $optimal_sector_size`"
- else
- lvm_start="`partition_sector_start $start $uefi_grub_end $optimal_sector_size`"
- fi
+ #lvm_start="$(($grub_end + 1))"
+ lvm_start="`partition_sector_start $start $grub_end $optimal_sector_size`"
#hydra_sudo_run parted -s -- $device unit MB mkpart ext2 3 -1
hydra_sudo_run parted -s -- $device mkpart ext2 ${lvm_start}s -1
@@ -323,15 +321,9 @@ else
syst_device="${device}${partition_separator}2"
else
# Make a 1024MB boot partition
- #boot_start="$(($bios_grub_end + 1))"
+ #boot_start="$(($grub_end + 1))"
boot_size="1024"
-
- if [ "$boot_mode" == "bios" ]; then
- boot_start="`partition_sector_start $start $bios_grub_end $optimal_sector_size`"
- else
- boot_start="`partition_sector_start $start $uefi_grub_end $optimal_sector_size`"
- fi
-
+ boot_start="`partition_sector_start $start $grub_end $optimal_sector_size`"
boot_size="$(($boot_size * $mebibyte / $block_size))"
boot_end="$(($boot_start + $boot_size -1))"
#lvm_start="$($boot_end + 1))"