Optimize some mounting functions to only setup some variables when needed
eg. when using auto partition no further setup is needed Also added dialog to give feedback when a partition is selected automatically
This commit is contained in:
parent
b3d7803cf0
commit
77c66897f4
@ -5,7 +5,7 @@
|
||||
# Some ideas and code reworked from other resources
|
||||
# AIF, Cnichi, Calamares, Arch Wiki.. Credit where credit is due
|
||||
|
||||
VER="2.0.50" # installer version
|
||||
VER="2.0.51" # installer version
|
||||
DIST="ArchLabs" # linux distributor
|
||||
MNT="/mnt" # install mountpoint
|
||||
ANS="/tmp/ans" # dialog answer file
|
||||
@ -1064,9 +1064,9 @@ part_cryptlv()
|
||||
|
||||
part_countdec()
|
||||
{
|
||||
for i in "$@"; do
|
||||
for pt; do
|
||||
if (( COUNT > 0 )); then
|
||||
PARTS="$(sed "/${i//\//\\/}/d" <<< "$PARTS")"
|
||||
PARTS="$(sed "/${pt//\//\\/}/d" <<< "$PARTS")"
|
||||
(( COUNT-- ))
|
||||
fi
|
||||
done
|
||||
@ -1199,6 +1199,10 @@ select_filesystem()
|
||||
|
||||
select_efi_partition()
|
||||
{
|
||||
if [[ $AUTO_BOOT_PART ]]; then
|
||||
msg "EFI Boot Partition" "\nUsing partition created during automatic format." 1
|
||||
BOOT_PART="$AUTO_BOOT_PART"; return 0 # were done here
|
||||
else
|
||||
local pts size dev isize bsize ptcount=0
|
||||
|
||||
# walk partition list and skip ones that are too small/big for boot
|
||||
@ -1209,13 +1213,13 @@ select_efi_partition()
|
||||
[[ $size_t =~ [KT] || ($size_t == 'G' && $isize -gt 2) || ($size_t == 'M' && $isize -lt 100) ]] || { pts+="$dev $size "; (( ptcount++ )); }
|
||||
done <<< "$PARTS"
|
||||
|
||||
if [[ $AUTO_BOOT_PART ]]; then
|
||||
BOOT_PART="$AUTO_BOOT_PART"; return 0 # were done here
|
||||
elif (( ptcount == 1 )); then
|
||||
if (( ptcount == 1 )); then
|
||||
msg "EFI Boot Partition" "\nOnly one partition that meets size requirements available." 1
|
||||
BOOT_PART="$(awk 'NF > 0 {print $1}' <<< "$pts")"
|
||||
else
|
||||
dlg BOOT_PART menu "EFI Partition" "$_uefi" $pts
|
||||
fi
|
||||
fi
|
||||
|
||||
[[ $BOOT_PART ]] || return 1
|
||||
|
||||
@ -1233,6 +1237,10 @@ select_efi_partition()
|
||||
|
||||
select_boot_partition()
|
||||
{
|
||||
if [[ $AUTO_BOOT_PART && ! $LVM ]]; then
|
||||
msg "BIOS Boot Partition" "\nUsing partition created during automatic format." 1
|
||||
BOOT_PART="$AUTO_BOOT_PART"; return 0 # were done here
|
||||
else
|
||||
local pts size dev isize bsize ptcount=0
|
||||
|
||||
# walk partition list and skip ones that are too small/big for boot
|
||||
@ -1243,15 +1251,14 @@ select_boot_partition()
|
||||
[[ $size_t =~ [KT] || ($size_t == 'G' && $isize -gt 2) || ($size_t == 'M' && $isize -lt 100) ]] || { pts+="$dev $size "; (( ptcount++ )); }
|
||||
done <<< "$PARTS"
|
||||
|
||||
if [[ $AUTO_BOOT_PART && ! $LVM ]]; then
|
||||
BOOT_PART="$AUTO_BOOT_PART"; return 0 # were done here
|
||||
elif [[ $LUKS && ! $LVM ]]; then
|
||||
if [[ $LUKS && ! $LVM ]]; then
|
||||
dlg BOOT_PART menu "Boot Partition" "$_biosluks" $pts
|
||||
[[ $BOOT_PART ]] || return 1
|
||||
else
|
||||
dlg BOOT_PART menu "Boot Partition" "$_bios" "skip" "don't use a separate boot" $pts
|
||||
[[ -z $BOOT_PART || $BOOT_PART == "skip" ]] && { BOOT_PART=''; return 0; }
|
||||
fi
|
||||
fi
|
||||
|
||||
if grep -q 'ext[34]' <<< "$(fsck -N "$BOOT_PART")"; then
|
||||
local txt="\nIMPORTANT:\n\nThe boot partition $BOOT_PART $_format"
|
||||
@ -1266,6 +1273,12 @@ select_boot_partition()
|
||||
|
||||
select_root_partition()
|
||||
{
|
||||
if [[ $AUTO_ROOT_PART && -z $LVM && -z $LUKS ]]; then
|
||||
ROOT_PART="$AUTO_ROOT_PART"
|
||||
msg "Select Root Partition (/)" "\nUsing partition created during automatic format." 1
|
||||
part_mount "$ROOT_PART" || { ROOT_PART=''; return 1; }
|
||||
return 0 # we're done here
|
||||
else
|
||||
local pts size dev isize bsize ptcount=0
|
||||
|
||||
# walk partition list and skip ones that are too small for / (root)
|
||||
@ -1276,15 +1289,13 @@ select_root_partition()
|
||||
[[ $size_t =~ [MK] || ($size_t == 'G' && $isize -lt 4) ]] || { pts+="$dev $size "; (( ptcount++ )); }
|
||||
done <<< "$PARTS"
|
||||
|
||||
if [[ $AUTO_ROOT_PART && -z $LVM && -z $LUKS ]]; then
|
||||
ROOT_PART="$AUTO_ROOT_PART"
|
||||
part_mount "$ROOT_PART" || { ROOT_PART=''; return 1; }
|
||||
return 0 # we're done here
|
||||
elif (( ptcount == 1 )); then # only one available device
|
||||
if (( ptcount == 1 )); then # only one available device
|
||||
msg "Select Root Partition (/)" "\nOnly one partition that meets size requirements available." 1
|
||||
ROOT_PART="$(awk 'NR==1 {print $1}' <<< "$pts")"
|
||||
else
|
||||
dlg ROOT_PART menu "Mount Root" "\nSelect the root (/) partition, this is where $DIST will be installed.\n\nDevices smaller than 8G will not be shown here." $pts
|
||||
fi
|
||||
fi
|
||||
[[ $ROOT_PART ]] || return 1
|
||||
|
||||
select_filesystem "$ROOT_PART" || { ROOT_PART=''; return 1; }
|
||||
@ -1295,16 +1306,16 @@ select_root_partition()
|
||||
|
||||
select_extra_partitions()
|
||||
{
|
||||
local part pts size dev isize bsize ptcount=0
|
||||
local part size dev
|
||||
|
||||
# walk partition list and skip ones that are too small to be usable
|
||||
while read -r dev size; do
|
||||
[[ ${size: -1:1} =~ [KM] ]] || { pts+="$dev $size "; (( ptcount++ )); }
|
||||
[[ ${size: -1:1} =~ [KM] ]] && part_countdec "$dev"
|
||||
done <<< "$PARTS"
|
||||
|
||||
while (( ptcount > 0 )); do
|
||||
while (( COUNT > 0 )); do
|
||||
part=''
|
||||
dlg part menu 'Mount Extra' "$_expart" 'done' 'finish mounting step' $pts || break
|
||||
dlg part menu 'Mount Extra' "$_expart" 'done' 'finish mounting step' $PARTS || break
|
||||
if [[ $part == 'done' ]]; then
|
||||
break
|
||||
elif select_filesystem "$part" && select_mountpoint && part_mount "$part" "$EXMNT"; then
|
||||
|
Reference in New Issue
Block a user