Fix: negative index error on empty string
This commit is contained in:
parent
caf5290f4d
commit
9f10cce8e4
@ -929,12 +929,14 @@ select_swap()
|
||||
{
|
||||
local pts dev size isize
|
||||
|
||||
if (( COUNT )) ; then
|
||||
while read -r dev size; do # walk partition list and skip ones that are too small/big for swap
|
||||
size_t="${size: -1:1}"
|
||||
isize=${size:0:-1}
|
||||
isize=${isize%.*}
|
||||
[[ $size_t =~ [KT] || ($size_t == 'G' && $isize -gt 16) || ($size_t == 'M' && $isize -lt 100) ]] || pts+="$dev $size "
|
||||
done <<< "$PARTS"
|
||||
fi
|
||||
|
||||
dlg SWAP_PART menu "Swap Setup" "\nSelect whether to use a swapfile, swap partition, or none." \
|
||||
"none" "Don't allocate any swap space" \
|
||||
@ -1027,12 +1029,14 @@ select_boot_partition()
|
||||
BOOT_PART="$AUTO_BOOT_PART"
|
||||
return 0
|
||||
else
|
||||
if (( COUNT )); then
|
||||
while read -r dev size; do # walk partition list and skip ones that are too small/big for boot
|
||||
size_t="${size: -1:1}"
|
||||
isize=${size:0:-1}
|
||||
isize=${isize%.*}
|
||||
[[ $size_t =~ [KT] || ($size_t == 'G' && $isize -gt 2) || ($size_t == 'M' && $isize -lt 100) ]] || { pts+="$dev $size "; (( ptcount++ )); }
|
||||
done <<< "$PARTS"
|
||||
fi
|
||||
|
||||
case "$SYS" in
|
||||
UEFI)
|
||||
@ -1044,11 +1048,15 @@ select_boot_partition()
|
||||
[[ $BOOT_PART ]] || return 1
|
||||
;;
|
||||
BIOS)
|
||||
(( ptcount == 0 )) && return 0
|
||||
if [[ $LUKS && ! $LVM ]]; then
|
||||
dlg BOOT_PART menu "Boot Partition" "$_biosluks" $pts
|
||||
case "$ptcount" in
|
||||
0) msg "Boot Partition" "\nLUKS without LVM requires a separate boot partition.\nNo partitions available that meet size requirements!!\n\nReturning to the main menu.\n" 2; return 1 ;;
|
||||
1) msg "Boot Partition" "\nOnly one partition available that meets size requirements.\n" 1; BOOT_PART="$(awk 'NF > 0 {print $1}' <<< "$pts")" ;;
|
||||
*) dlg BOOT_PART menu "Boot Partition" "$_biosluks" $pts ;;
|
||||
esac
|
||||
[[ $BOOT_PART ]] || return 1
|
||||
else
|
||||
(( ptcount == 0 )) && return 0
|
||||
dlg BOOT_PART menu "Boot Partition" "$_bios" "skip" "no separate boot" $pts
|
||||
[[ -z $BOOT_PART || $BOOT_PART == "skip" ]] && { BOOT_PART=''; return 0; }
|
||||
fi
|
||||
@ -1108,9 +1116,11 @@ select_extra_partitions()
|
||||
local part dev size
|
||||
|
||||
# walk partition list and skip ones that are too small to be usable
|
||||
if (( COUNT )); then
|
||||
while read -r dev size; do
|
||||
[[ ${size: -1:1} =~ [KM] ]] && part_countdec "$dev"
|
||||
done <<< "$PARTS"
|
||||
fi
|
||||
|
||||
while (( COUNT > 0 )); do
|
||||
part=''
|
||||
|
Reference in New Issue
Block a user