From 647da12b431f1bc1d3153616dd0e5b376717737c Mon Sep 17 00:00:00 2001 From: thiblizz <101073848+thiblizz@users.noreply.github.com> Date: Sat, 21 Oct 2023 16:36:28 +0200 Subject: [PATCH] fix: address review comments --- configure | 2 +- scripts/functions.sh | 38 ++++++++++++++++---------------------- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/configure b/configure index 8034c6f..78d14a0 100755 --- a/configure +++ b/configure @@ -1168,7 +1168,7 @@ function PARTITIONING_DEVICES_label() { if [[ "$invalid" -gt 0 ]]; then echo " └ (${#PARTITIONING_DEVICES[@]} devices, \Z1$invalid invalid\Zn)" - elif [[ "${#PARTITIONING_DEVICES[@]}" -eq 1 && "$PARTITIONING_SCHEME" == "raid0_luks" || "$PARTITIONING_SCHEME" == "raid1_luks" ]]; then + elif [[ "${#PARTITIONING_DEVICES[@]}" -eq 1 && ("$PARTITIONING_SCHEME" == "raid0_luks" || "$PARTITIONING_SCHEME" == "raid1_luks") ]]; then echo " └ (${#PARTITIONING_DEVICES[@]} devices, \Z1need at least 2\Zn)" elif [[ "${#PARTITIONING_DEVICES[@]}" -eq 0 ]]; then echo " └ (${#PARTITIONING_DEVICES[@]} devices, \Z1need at least 1\Zn)" diff --git a/scripts/functions.sh b/scripts/functions.sh index 51614cf..a760b40 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -276,6 +276,7 @@ function disk_create_raid() { local devices_desc="" local devices=() + local extra_args=() local id local dev # Splitting is intentional here @@ -291,31 +292,24 @@ function disk_create_raid() { local mddevice="/dev/md/$name" local uuid="${DISK_ID_TO_UUID[$new_id]}" + extra_args=() if [[ ${level} == 1 ]]; then - einfo "Creating raid$level ($new_id) on $devices_desc" - mdadm \ - --create "$mddevice" \ - --verbose \ - --homehost="$HOSTNAME" \ - --metadata=1.0 \ - --raid-devices="${#devices[@]}" \ - --uuid="$uuid" \ - --level="$level" \ - "${devices[@]}" \ - || die "Could not create raid$level array '$mddevice' ($new_id) on $devices_desc" + extra_args+=("--metadata=1.0") else - einfo "Creating raid$level ($new_id) on $devices_desc" - mdadm \ - --create "$mddevice" \ - --verbose \ - --homehost="$HOSTNAME" \ - --metadata=1.2 \ - --raid-devices="${#devices[@]}" \ - --uuid="$uuid" \ - --level="$level" \ - "${devices[@]}" \ - || die "Could not create raid$level array '$mddevice' ($new_id) on $devices_desc" + extra_args+=("--metadata=1.2") fi + + einfo "Creating raid$level ($new_id) on $devices_desc" + mdadm \ + --create "$mddevice" \ + --verbose \ + --homehost="$HOSTNAME" \ + "${extra_args[@]}" \ + --raid-devices="${#devices[@]}" \ + --uuid="$uuid" \ + --level="$level" \ + "${devices[@]}" \ + || die "Could not create raid$level array '$mddevice' ($new_id) on $devices_desc" } function disk_create_luks() {