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
|
local pts dev size isize
|
||||||
|
|
||||||
while read -r dev size; do # walk partition list and skip ones that are too small/big for swap
|
if (( COUNT )) ; then
|
||||||
size_t="${size: -1:1}"
|
while read -r dev size; do # walk partition list and skip ones that are too small/big for swap
|
||||||
isize=${size:0:-1}
|
size_t="${size: -1:1}"
|
||||||
isize=${isize%.*}
|
isize=${size:0:-1}
|
||||||
[[ $size_t =~ [KT] || ($size_t == 'G' && $isize -gt 16) || ($size_t == 'M' && $isize -lt 100) ]] || pts+="$dev $size "
|
isize=${isize%.*}
|
||||||
done <<< "$PARTS"
|
[[ $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." \
|
dlg SWAP_PART menu "Swap Setup" "\nSelect whether to use a swapfile, swap partition, or none." \
|
||||||
"none" "Don't allocate any swap space" \
|
"none" "Don't allocate any swap space" \
|
||||||
@ -1027,12 +1029,14 @@ select_boot_partition()
|
|||||||
BOOT_PART="$AUTO_BOOT_PART"
|
BOOT_PART="$AUTO_BOOT_PART"
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
while read -r dev size; do # walk partition list and skip ones that are too small/big for boot
|
if (( COUNT )); then
|
||||||
size_t="${size: -1:1}"
|
while read -r dev size; do # walk partition list and skip ones that are too small/big for boot
|
||||||
isize=${size:0:-1}
|
size_t="${size: -1:1}"
|
||||||
isize=${isize%.*}
|
isize=${size:0:-1}
|
||||||
[[ $size_t =~ [KT] || ($size_t == 'G' && $isize -gt 2) || ($size_t == 'M' && $isize -lt 100) ]] || { pts+="$dev $size "; (( ptcount++ )); }
|
isize=${isize%.*}
|
||||||
done <<< "$PARTS"
|
[[ $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
|
case "$SYS" in
|
||||||
UEFI)
|
UEFI)
|
||||||
@ -1044,11 +1048,15 @@ select_boot_partition()
|
|||||||
[[ $BOOT_PART ]] || return 1
|
[[ $BOOT_PART ]] || return 1
|
||||||
;;
|
;;
|
||||||
BIOS)
|
BIOS)
|
||||||
(( ptcount == 0 )) && return 0
|
|
||||||
if [[ $LUKS && ! $LVM ]]; then
|
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
|
[[ $BOOT_PART ]] || return 1
|
||||||
else
|
else
|
||||||
|
(( ptcount == 0 )) && return 0
|
||||||
dlg BOOT_PART menu "Boot Partition" "$_bios" "skip" "no separate boot" $pts
|
dlg BOOT_PART menu "Boot Partition" "$_bios" "skip" "no separate boot" $pts
|
||||||
[[ -z $BOOT_PART || $BOOT_PART == "skip" ]] && { BOOT_PART=''; return 0; }
|
[[ -z $BOOT_PART || $BOOT_PART == "skip" ]] && { BOOT_PART=''; return 0; }
|
||||||
fi
|
fi
|
||||||
@ -1108,9 +1116,11 @@ select_extra_partitions()
|
|||||||
local part dev size
|
local part dev size
|
||||||
|
|
||||||
# walk partition list and skip ones that are too small to be usable
|
# walk partition list and skip ones that are too small to be usable
|
||||||
while read -r dev size; do
|
if (( COUNT )); then
|
||||||
[[ ${size: -1:1} =~ [KM] ]] && part_countdec "$dev"
|
while read -r dev size; do
|
||||||
done <<< "$PARTS"
|
[[ ${size: -1:1} =~ [KM] ]] && part_countdec "$dev"
|
||||||
|
done <<< "$PARTS"
|
||||||
|
fi
|
||||||
|
|
||||||
while (( COUNT > 0 )); do
|
while (( COUNT > 0 )); do
|
||||||
part=''
|
part=''
|
||||||
|
Reference in New Issue
Block a user