Fix disk selection for installer prompts

This commit is contained in:
randogoth 2026-02-01 20:35:07 +02:00
parent a0bee59a28
commit defa82c46c

View file

@ -85,6 +85,7 @@ if (( ! NON_INTERACTIVE )); then
disk_choices+=("$d" "") disk_choices+=("$d" "")
done done
DISK=$(prompt_select "disk" "Select target disk (will be wiped)" "${disk_choices[@]}") DISK=$(prompt_select "disk" "Select target disk (will be wiped)" "${disk_choices[@]}")
DISK=${DISK%% *} # strip size suffix from selection
fi fi
target_mode=$(prompt_select "mode" "Partitioning mode" \ target_mode=$(prompt_select "mode" "Partitioning mode" \
@ -129,6 +130,11 @@ mapper_root=""
echo "[1/8] Partitioning/selection" echo "[1/8] Partitioning/selection"
if [[ -z "$ROOT_PART" ]]; then if [[ -z "$ROOT_PART" ]]; then
if [[ ! -b "$DISK" ]]; then
echo "Error: target disk ${DISK} not found. Available disks:"
ls_disks
exit 1
fi
printf "label: gpt\n,550M,U,boot\n,,L,cryptroot\n" | sfdisk "${DISK}" printf "label: gpt\n,550M,U,boot\n,,L,cryptroot\n" | sfdisk "${DISK}"
part_boot="${DISK}1" part_boot="${DISK}1"
part_root="${DISK}2" part_root="${DISK}2"