From fcdf39097149b5c351ae4787d54abf596dd23154 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 9 Jan 2022 10:57:40 -0300 Subject: Fix: hydractl: provision: set partition naming scheme --- share/hydractl/provision | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/share/hydractl/provision b/share/hydractl/provision index c3f4620..3176f21 100755 --- a/share/hydractl/provision +++ b/share/hydractl/provision @@ -189,6 +189,23 @@ fi # Check number of devices num_devices="`echo $device | wc -w`" +# Set partition naming scheme +# +# "Partition device names are a combination of the drive's device name and the +# partition number assigned to them in the partition table, i.e. +# /dev/drivepartition. For drives whose device name ends with a number, the +# drive name and partition number is separated with the letter "p", i.e. +# /dev/driveppartition." +# +# -- https://wiki.archlinux.org/title/Device_file +# +#if echo $device | grep -q -E 'nvme|mmcblk'; then +if echo $device | grep -q -E '[0-9]$'; then + partition_separator="p" +else + partition_separator="" +fi + # RAID: do this instead of regular partitioning. if [ "$num_devices" != "1" ]; then # Force encryption and fix device name. @@ -262,8 +279,8 @@ else hydra_sudo_run parted -s -- $device mkpart ext2 ${lvm_start}s -1 hydra_sudo_run parted -s -- $device set 2 lvm on - boot_device="$device"2 - syst_device="$device"2 + boot_device="${device}${partition_separator}2" + syst_device="${device}${partition_separator}2" else # Make a 1024MB boot partition #boot_start="$(($bios_grub_end + 1))" @@ -279,8 +296,8 @@ else hydra_sudo_run parted -s -- $device mkpart ext2 ${lvm_start}s -1 hydra_sudo_run parted -s -- $device set 3 lvm on - boot_device="$device"2 - syst_device="$device"3 + boot_device="${device}${partition_separator}2" + syst_device="${device}${partition_separator}3" fi fi -- cgit v1.2.3