Initial work on mountless install
This commit is contained in:
parent
62125fc64b
commit
ef9edc0d62
@ -7,7 +7,7 @@
|
||||
|
||||
# shellcheck disable=SC2086,SC2046,SC2254
|
||||
|
||||
VER=2.1.47
|
||||
VER=2.1.48
|
||||
|
||||
# default values {
|
||||
|
||||
@ -370,13 +370,38 @@ _lvmerrlvsize="\nInvalid value Entered.\n\nMust be a numeric value with 'M' (meg
|
||||
|
||||
main()
|
||||
{
|
||||
# increment SEL every time we enter main() if we're not at the end of the menu
|
||||
(( SEL < 13 )) && (( SEL++ ))
|
||||
|
||||
if [[ $NOMOUNT ]]; then
|
||||
(( SEL < 8 )) && (( SEL++ ))
|
||||
tput civis
|
||||
dialog --backtitle "$DIST Installer - $SYS - v$VER" --title " Prepare " \
|
||||
--default-item $SEL --cancel-label 'Exit' --menu "$_prep" 0 0 0 \
|
||||
1 "Show device tree" \
|
||||
1 "* Select bootloader" \
|
||||
2 "* Username and password" \
|
||||
3 "* System configuration" \
|
||||
4 "Select window manager or desktop" \
|
||||
5 "Select additional packages" \
|
||||
6 "Run a command on the installed system" \
|
||||
7 "View configuration and command selections" \
|
||||
8 "* Confirm choices and finish installation" 2> "$ANS"
|
||||
|
||||
read -r SEL < "$ANS"
|
||||
case $SEL in
|
||||
1) prechecks 0 && { select_bootldr || (( SEL-- )); } ;;
|
||||
2) prechecks 1 && { select_mkuser || (( SEL-- )); } ;;
|
||||
3) prechecks 2 && { select_config || (( SEL-- )); } ;;
|
||||
4) prechecks 3 && { select_sessions || (( SEL-- )); } ;;
|
||||
5) prechecks 3 && { select_packages || (( SEL-- )); } ;;
|
||||
6) prechecks 3 && select_usercmd ;;
|
||||
7) prechecks 3 && select_show ;;
|
||||
8) prechecks 3 && install_main ;;
|
||||
*) yesno "Exit" "\nUnmount partitions (if any) and exit the installer?\n" && die 0
|
||||
esac
|
||||
else
|
||||
(( SEL < 13 )) && (( SEL++ ))
|
||||
tput civis
|
||||
dialog --backtitle "$DIST Installer - $SYS - v$VER" --title " Prepare " \
|
||||
--default-item $SEL --cancel-label 'Exit' --menu "$_prep" 0 0 0 \
|
||||
1 "Device tree" \
|
||||
2 "Partitioning" \
|
||||
3 "LUKS encryption" \
|
||||
4 "Logical volume management" \
|
||||
@ -388,13 +413,10 @@ main()
|
||||
10 "Select additional packages" \
|
||||
11 "Run a command on the installed system" \
|
||||
12 "View configuration and command selections" \
|
||||
13 "* Confirm choices and start the installation" 2> "$ANS"
|
||||
13 "* Confirm choices and finish installation" 2> "$ANS"
|
||||
|
||||
read -r SEL < "$ANS"
|
||||
[[ -z $WARN && $SEL =~ (2|5) ]] && { msg "Data Warning" "$_warn"; WARN=true; }
|
||||
|
||||
# if the operation returns an error we decrement SEL, prechecks() will
|
||||
# also set SEL to even further back based on what is needed to continue
|
||||
case $SEL in
|
||||
1) part_show ;;
|
||||
2) part_menu || (( SEL-- )) ;;
|
||||
@ -411,6 +433,7 @@ main()
|
||||
13) prechecks 3 && install_main ;;
|
||||
*) yesno "Exit" "\nUnmount partitions (if any) and exit the installer?\n" && die 0
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
select_show()
|
||||
@ -1037,7 +1060,7 @@ part_pretty()
|
||||
[[ $dev && $size ]] || continue
|
||||
s=${size%%__*}
|
||||
size_t="${s: -1:1}"
|
||||
isize=${s:0:-1}
|
||||
isize=${s:0: -1}
|
||||
isize=${isize%.*}
|
||||
if [[ $dev = /dev/nvme* ]]; then
|
||||
model=$(lsblk -lno MODEL "${dev%p[1-9]}" | awk '{gsub(/ |\t/, "_"); print}')
|
||||
@ -1160,8 +1183,8 @@ part_countdec()
|
||||
|
||||
mount_menu()
|
||||
{
|
||||
msg "Mount Menu" "\nGathering device and partition information.\n" 1
|
||||
is_bg_install || return 0
|
||||
msg "Mount Menu" "\nGathering device and partition information.\n" 1
|
||||
lvm_detect
|
||||
umount_dir "$MNT"
|
||||
part_find 'part|lvm|crypt' || { SEL=2; return 1; }
|
||||
@ -1279,7 +1302,7 @@ select_root()
|
||||
while read -r dev size; do
|
||||
s=${size%%__*}
|
||||
size_t="${s: -1:1}"
|
||||
isize=${s:0:-1}
|
||||
isize=${s:0: -1}
|
||||
isize=${isize%.*}
|
||||
if ! [[ $size_t == 'M' || ($size_t == 'G' && $isize -lt 8) ]]; then
|
||||
pts+="$dev $size "
|
||||
@ -1313,7 +1336,7 @@ select_swap()
|
||||
while read -r dev size; do # walk partition list and skip ones that are > 64G
|
||||
s=${size%%__*}
|
||||
size_t="${s: -1:1}"
|
||||
isize=${s:0:-1}
|
||||
isize=${s:0: -1}
|
||||
isize=${isize%.*}
|
||||
if ! [[ $size_t == 'T' || ($size_t == 'G' && $isize -gt 64) ]]; then
|
||||
pts+="$dev $size "
|
||||
@ -2415,7 +2438,7 @@ lvm_mkgroup()
|
||||
VGROUP_MB=$SIZE
|
||||
fi
|
||||
|
||||
msg "$_lvmnew" "\nVolume group $VGROUP (${SIZE}$SIZE_UNIT) successfully created\n"
|
||||
msg "$_lvmnew" "\nVolume group $VGROUP (${SIZE}$SIZE_UNIT) successfully created\n" 2
|
||||
}
|
||||
|
||||
lvm_del_all()
|
||||
@ -2471,6 +2494,7 @@ lvm_partitions()
|
||||
{
|
||||
part_find 'part|crypt' || return 1
|
||||
PARTS="$(awk 'NF > 0 {print $0 " off"}' <<< "$PARTS")"
|
||||
[[ $LUKS && $LUKS_PART ]] && part_countdec $LUKS_PART
|
||||
dlg LVM_PARTS check "$_lvmnew" "\nSelect the partition(s) to use for the physical volume (PV)." $PARTS
|
||||
}
|
||||
|
||||
@ -2537,6 +2561,7 @@ luks_open()
|
||||
if (( PART_COUNT == 1 )); then
|
||||
LUKS_PART="$(awk 'NF > 0 {print $1}' <<< "$PARTS")"
|
||||
else
|
||||
[[ $LVM && $LVM_PARTS ]] && part_countdec $LVM_PARTS
|
||||
dlg LUKS_PART menu "$_luksopen" "\nSelect which partition to open." $PARTS
|
||||
fi
|
||||
|
||||
@ -2598,6 +2623,7 @@ luks_setup()
|
||||
elif (( PART_COUNT == 1 )); then
|
||||
LUKS_PART="$(awk 'NF > 0 {print $1}' <<< "$PARTS")"
|
||||
else
|
||||
[[ $LVM && $LVM_PARTS ]] && part_countdec $LVM_PARTS
|
||||
dlg LUKS_PART menu "$_luksnew" "\nSelect the partition you want to encrypt." $PARTS
|
||||
fi
|
||||
|
||||
@ -3069,11 +3095,34 @@ fi
|
||||
# trap ^C to perform cleanup
|
||||
trap 'printf "\n^C\n" && die 1' INT
|
||||
|
||||
while getopts ":htl:d" OPT; do
|
||||
while getopts ":htl:dnr:b:" OPT; do
|
||||
case "$OPT" in
|
||||
d) debug ;;
|
||||
h) usage "$0" ;;
|
||||
t) TEARFREE=true ;;
|
||||
n)
|
||||
NOMOUNT=true
|
||||
;;
|
||||
r)
|
||||
if [[ ! -b $OPTARG ]]; then
|
||||
echo "invalid root: $OPTARG"
|
||||
die 1
|
||||
fi
|
||||
ROOT=$OPTARG
|
||||
;;
|
||||
b)
|
||||
if [[ ! -b $OPTARG ]]; then
|
||||
echo "invalid boot: $OPTARG"
|
||||
die 1
|
||||
fi
|
||||
BOOT=$OPTARG
|
||||
;;
|
||||
d)
|
||||
debug
|
||||
;;
|
||||
h)
|
||||
usage "$0"
|
||||
;;
|
||||
t)
|
||||
TEARFREE=true
|
||||
;;
|
||||
l)
|
||||
if [[ "${!WM_SESSIONS[*]}" =~ $OPTARG ]]; then
|
||||
live "$OPTARG"
|
||||
@ -3081,24 +3130,42 @@ while getopts ":htl:d" OPT; do
|
||||
echo "error: invalid session for -l, see -h for help"; die 1
|
||||
fi
|
||||
;;
|
||||
\?) echo "error: invalid option: -$OPTARG"; die 1 ;;
|
||||
\?)
|
||||
echo "invalid option: $OPTARG"
|
||||
die 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
system_identify
|
||||
system_devices
|
||||
|
||||
fontsize=16
|
||||
while :; do
|
||||
if [[ $NOMOUNT ]]; then
|
||||
if [[ (-z $ROOT || ($SYS == 'UEFI' && -z $BOOT)) ]]; then
|
||||
msg "Not Enough Partitions" "$_errpart" 0
|
||||
die 1
|
||||
fi
|
||||
if [[ $BOOT ]]; then
|
||||
part_bootdev
|
||||
SEP_BOOT=true
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -f /tmp/hassetfont ]]; then
|
||||
FONT="$(< /tmp/hassetfont)"
|
||||
setfont "$FONT"
|
||||
else
|
||||
fontsize=16
|
||||
while [[ ! -f /tmp/hassetfont ]]; do
|
||||
dlg fontsize menu "Font Size" "\nSelect a font size from the list below.\n\nDefault: 16" \
|
||||
12 "setfont ter-i12n" 14 "setfont ter-i14n" 16 "setfont ter-i16n" 18 "setfont ter-i18n" \
|
||||
20 "setfont ter-i20n" 22 "setfont ter-i22n" 24 "setfont ter-i24n" 28 "setfont ter-i28n" \
|
||||
32 "setfont ter-i32n" || break
|
||||
|
||||
FONT="ter-i${fontsize}n"
|
||||
setfont "$FONT"
|
||||
yesno "Font Size" "\nKeep the currently set font size?\n" && break
|
||||
done
|
||||
yesno "Font Size" "\nKeep the currently set font size?\n" && echo "ter-i${fontsize}n" > /tmp/hassetfont
|
||||
done
|
||||
fi
|
||||
|
||||
msg "Welcome to the $DIST Installer" "$_welcome"
|
||||
|
||||
@ -3110,6 +3177,12 @@ elif ! net_connect; then
|
||||
die 1
|
||||
fi
|
||||
|
||||
if [[ $NOMOUNT ]]; then
|
||||
wrn="\nA background install process will begin early when using -n flag\n\nSome files may be overwritten during the process\n"
|
||||
yesno "Data Warning" "$wrn\nProceed?\n" || die 0
|
||||
install_background
|
||||
fi
|
||||
|
||||
while :; do
|
||||
main
|
||||
done
|
||||
|
Reference in New Issue
Block a user