aboutsummaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
Diffstat (limited to 'share')
-rwxr-xr-xshare/hydractl/provision25
1 files 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