Allow setting root and boot partitions before running

This commit is contained in:
natemaia 2019-10-17 17:19:00 -07:00
parent 5c0ea2c6a3
commit 5f48915a32

View File

@ -1007,6 +1007,7 @@ select_mountpoint()
EXMNT='' EXMNT=''
fi fi
done done
msg "Mount Extra" "\nMounting Finished\n\n\nNo extra partitions available to mount, returning to main menu.\n" 2
return 0 return 0
} }
@ -1033,25 +1034,27 @@ select_filesystem()
select_efi_partition() select_efi_partition()
{ {
if [[ $AUTO_BOOT_PART ]]; then if [[ -z $BOOT_PART ]]; then
BOOT_PART="$AUTO_BOOT_PART" if [[ $AUTO_BOOT_PART ]]; then
return 0 # were done here BOOT_PART="$AUTO_BOOT_PART"
else return 0 # were done here
local pts size dev isize bsize ptcount=0
# walk partition list and skip ones that are too small/big for boot
while read -r dev size; do
size_t="${size: -1:1}" # size type eg. K, M, G, T
isize=${size:0:-1} # remove trailing size type character
isize=${isize%.*} # remove any decimal (round down)
[[ $size_t =~ [KT] || ($size_t == 'G' && $isize -gt 2) || ($size_t == 'M' && $isize -lt 100) ]] || { pts+="$dev $size "; (( ptcount++ )); }
done <<< "$PARTS"
if (( ptcount == 1 )); then
msg "EFI Boot Partition" "\nOnly one partition available that meets size requirements.\n" 1
BOOT_PART="$(awk 'NF > 0 {print $1}' <<< "$pts")"
else else
dlg BOOT_PART menu "EFI Partition" "$_uefi" $pts local pts size dev isize bsize ptcount=0
# walk partition list and skip ones that are too small/big for boot
while read -r dev size; do
size_t="${size: -1:1}" # size type eg. K, M, G, T
isize=${size:0:-1} # remove trailing size type character
isize=${isize%.*} # remove any decimal (round down)
[[ $size_t =~ [KT] || ($size_t == 'G' && $isize -gt 2) || ($size_t == 'M' && $isize -lt 100) ]] || { pts+="$dev $size "; (( ptcount++ )); }
done <<< "$PARTS"
if (( ptcount == 1 )); then
msg "EFI Boot Partition" "\nOnly one partition available that meets size requirements.\n" 1
BOOT_PART="$(awk 'NF > 0 {print $1}' <<< "$pts")"
else
dlg BOOT_PART menu "EFI Partition" "$_uefi" $pts
fi
fi fi
fi fi
@ -1071,26 +1074,28 @@ select_efi_partition()
select_boot_partition() select_boot_partition()
{ {
if [[ $AUTO_BOOT_PART && ! $LVM ]]; then if [[ -z $BOOT_PART ]]; then
BOOT_PART="$AUTO_BOOT_PART" if [[ $AUTO_BOOT_PART && ! $LVM ]]; then
return 0 # were done here BOOT_PART="$AUTO_BOOT_PART"
else return 0 # were done here
local pts size dev isize bsize ptcount=0
# walk partition list and skip ones that are too small/big for boot
while read -r dev size; do
size_t="${size: -1:1}" # size type eg. K, M, G, T
isize=${size:0:-1} # remove trailing size type character
isize=${isize%.*} # remove any decimal (round down)
[[ $size_t =~ [KT] || ($size_t == 'G' && $isize -gt 2) || ($size_t == 'M' && $isize -lt 100) ]] || { pts+="$dev $size "; (( ptcount++ )); }
done <<< "$PARTS"
if [[ $LUKS && ! $LVM ]]; then
dlg BOOT_PART menu "Boot Partition" "$_biosluks" $pts
[[ $BOOT_PART ]] || return 1
else else
dlg BOOT_PART menu "Boot Partition" "$_bios" "skip" "don't use a separate boot" $pts local pts size dev isize bsize ptcount=0
[[ -z $BOOT_PART || $BOOT_PART == "skip" ]] && { BOOT_PART=''; return 0; }
# walk partition list and skip ones that are too small/big for boot
while read -r dev size; do
size_t="${size: -1:1}" # size type eg. K, M, G, T
isize=${size:0:-1} # remove trailing size type character
isize=${isize%.*} # remove any decimal (round down)
[[ $size_t =~ [KT] || ($size_t == 'G' && $isize -gt 2) || ($size_t == 'M' && $isize -lt 100) ]] || { pts+="$dev $size "; (( ptcount++ )); }
done <<< "$PARTS"
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 fi
fi fi
@ -1107,27 +1112,29 @@ select_boot_partition()
select_root_partition() select_root_partition()
{ {
if [[ $AUTO_ROOT_PART && -z $LVM && -z $LUKS ]]; then if [[ -z $ROOT_PART ]]; then
ROOT_PART="$AUTO_ROOT_PART" if [[ $AUTO_ROOT_PART && -z $LVM && -z $LUKS ]]; then
msg "Mount Menu" "\nUsing partitions created during automatic format.\n" 2 ROOT_PART="$AUTO_ROOT_PART"
part_mount "$ROOT_PART" || { ROOT_PART=''; return 1; } msg "Mount Menu" "\nUsing partitions created during automatic format.\n" 2
return 0 # we're done here part_mount "$ROOT_PART" || { ROOT_PART=''; return 1; }
else return 0 # we're done here
local pts size dev isize bsize ptcount=0
# walk partition list and skip ones that are too small for / (root)
while read -r dev size; do
size_t="${size: -1:1}" # size type eg. K, M, G, T
isize=${size:0:-1} # remove trailing size type character
isize=${isize%.*} # remove any decimal (round down)
[[ $size_t =~ [MK] || ($size_t == 'G' && $isize -lt 4) ]] || { pts+="$dev $size "; (( ptcount++ )); }
done <<< "$PARTS"
if (( ptcount == 1 )); then # only one available device
msg "Root Partition (/)" "\nOnly one partition available that meets size requirements.\n" 2
ROOT_PART="$(awk 'NF > 0 {print $1}' <<< "$pts")"
else 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 local pts size dev isize bsize ptcount=0
# walk partition list and skip ones that are too small for / (root)
while read -r dev size; do
size_t="${size: -1:1}" # size type eg. K, M, G, T
isize=${size:0:-1} # remove trailing size type character
isize=${isize%.*} # remove any decimal (round down)
[[ $size_t =~ [MK] || ($size_t == 'G' && $isize -lt 4) ]] || { pts+="$dev $size "; (( ptcount++ )); }
done <<< "$PARTS"
if (( ptcount == 1 )); then # only one available device
msg "Root Partition (/)" "\nOnly one partition available that meets size requirements.\n" 2
ROOT_PART="$(awk 'NF > 0 {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 fi
fi fi
@ -1135,7 +1142,6 @@ select_root_partition()
ROOT_PART='' ROOT_PART=''
return 1 return 1
fi fi
return 0 return 0
} }
@ -2189,7 +2195,7 @@ usage()
options: options:
-h, --help print this message and exit -h, --help print this message and exit
-l, --live install and setup a live session -l, --live install and setup a live session
-d, --debug enable debugging and log output to $DBG -d, --debug enable xtrace and log output to $DBG
sessions: sessions:
i3-gaps - A fork of i3wm with more features including gaps i3-gaps - A fork of i3wm with more features including gaps
@ -2203,6 +2209,18 @@ usage()
plasma - A kde software project currently comprising a full desktop environment plasma - A kde software project currently comprising a full desktop environment
xfce4 - A lightweight and modular desktop environment based on gtk+2/3 xfce4 - A lightweight and modular desktop environment based on gtk+2/3
distro name:
set the DIST environment variable before launching the installer eg.
DIST='MyDistro' $1
editor used:
set the EDITOR environment variable before launching the installer eg.
EDITOR='nano' $1
EOF EOF
exit 0 exit 0
} }