aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2022-01-09 10:57:40 -0300
committerSilvio Rhatto <rhatto@riseup.net>2022-01-09 10:57:40 -0300
commitfcdf39097149b5c351ae4787d54abf596dd23154 (patch)
treedbfe67550c1f7fd24eba81eb269bfe59e3892496
parent254c7def6f68b5529686d331b98c60a77780ff0f (diff)
downloadhydra-fcdf39097149b5c351ae4787d54abf596dd23154.tar.gz
hydra-fcdf39097149b5c351ae4787d54abf596dd23154.tar.bz2
Fix: hydractl: provision: set partition naming scheme
-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