-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·679 lines (610 loc) · 22.9 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·679 lines (610 loc) · 22.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
#!/usr/bin/env bash
# install.sh — Main entry point for the Void Linux TUI Installer
#
# Usage:
# ./install.sh — Run full installation (TUI wizard + install)
# ./install.sh --configure — Run only the TUI wizard (generate config)
# ./install.sh --install — Run only the installation (using existing config)
# ./install.sh --dry-run — Run wizard + simulate installation
# ./install.sh __chroot_phase — (Internal) Run chroot phase
#
set -Eeuo pipefail
shopt -s inherit_errexit
_err_handler() {
local rc=$1 line=$2 src=$3 func=$4
# Restore stderr if redirected to log (fd 4 trick from screen_progress)
if { true >&4; } 2>/dev/null; then exec 2>&4; fi
echo "[ERR] ${src}:${line} (${func}) exit=${rc}" >&2
echo "[ERR] ${src}:${line} (${func}) exit=${rc}" >> "${LOG_FILE:-/tmp/void-installer.log}"
}
trap '_err_handler $? ${LINENO} "${BASH_SOURCE[0]:-?}" "${FUNCNAME[0]:-main}"' ERR
# Mark as the Void installer (used by protection.sh)
export _VOID_INSTALLER=1
# Determine script directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export SCRIPT_DIR
export LIB_DIR="${SCRIPT_DIR}/lib"
export TUI_DIR="${SCRIPT_DIR}/tui"
export DATA_DIR="${SCRIPT_DIR}/data"
# --- Source library modules ---
source "${LIB_DIR}/constants.sh"
source "${LIB_DIR}/logging.sh"
source "${LIB_DIR}/utils.sh"
source "${LIB_DIR}/dialog.sh"
source "${LIB_DIR}/config.sh"
source "${LIB_DIR}/hardware.sh"
source "${LIB_DIR}/disk.sh"
source "${LIB_DIR}/network.sh"
source "${LIB_DIR}/rootfs.sh"
source "${LIB_DIR}/xbps.sh"
source "${LIB_DIR}/kernel.sh"
source "${LIB_DIR}/bootloader.sh"
source "${LIB_DIR}/secureboot.sh"
source "${LIB_DIR}/system.sh"
source "${LIB_DIR}/desktop.sh"
source "${LIB_DIR}/swap.sh"
source "${LIB_DIR}/umpc.sh"
source "${LIB_DIR}/apple.sh"
source "${LIB_DIR}/luks.sh"
source "${LIB_DIR}/snapper.sh"
source "${LIB_DIR}/chroot.sh"
source "${LIB_DIR}/hooks.sh"
source "${LIB_DIR}/preset.sh"
# --- Source TUI screens ---
source "${TUI_DIR}/welcome.sh"
source "${TUI_DIR}/preset_load.sh"
source "${TUI_DIR}/hw_detect.sh"
source "${TUI_DIR}/wifi_config.sh"
source "${TUI_DIR}/disk_select.sh"
source "${TUI_DIR}/filesystem_select.sh"
source "${TUI_DIR}/swap_config.sh"
source "${TUI_DIR}/network_config.sh"
source "${TUI_DIR}/locale_config.sh"
source "${TUI_DIR}/kernel_select.sh"
source "${TUI_DIR}/secureboot_config.sh"
source "${TUI_DIR}/gpu_config.sh"
source "${TUI_DIR}/desktop_select.sh"
source "${TUI_DIR}/desktop_config.sh"
source "${TUI_DIR}/user_config.sh"
source "${TUI_DIR}/extra_packages.sh"
source "${TUI_DIR}/preset_save.sh"
source "${TUI_DIR}/summary.sh"
source "${TUI_DIR}/progress.sh"
# --- Source data files ---
source "${DATA_DIR}/gpu_database.sh"
source "${DATA_DIR}/mirrors.sh"
# --- Cleanup trap ---
cleanup() {
local rc=$?
# Restore terminal echo (gum backend may disable it)
stty echo </dev/tty 2>/dev/null || true
# Restore stderr if it was redirected to log file (fd 4 saved by screen_progress)
if { true >&4; } 2>/dev/null; then
exec 2>&4
exec 4>&-
fi
if [[ "${_IN_CHROOT:-0}" != "1" ]]; then
# Only do cleanup in outer process
if mountpoint -q "${MOUNTPOINT}/proc" 2>/dev/null; then
ewarn "Cleaning up mount points..."
chroot_teardown || true
fi
fi
if [[ ${rc} -ne 0 ]]; then
eerror "Installer exited with code ${rc}"
eerror "Log file: ${LOG_FILE}"
fi
return ${rc}
}
trap cleanup EXIT
trap 'trap - EXIT; cleanup; exit 130' INT
trap 'trap - EXIT; cleanup; exit 143' TERM
# --- Parse arguments ---
MODE="full"
DRY_RUN=0
FORCE=0
NON_INTERACTIVE=0
export DRY_RUN FORCE NON_INTERACTIVE
usage() {
cat <<'EOF'
Void Linux TUI Installer
Usage:
install.sh [OPTIONS] [COMMAND]
Commands:
(default) Run full installation (wizard + install)
--configure Run only the TUI configuration wizard
--install Run only the installation phase (requires config)
--resume Resume interrupted installation (scan disks for checkpoints)
__chroot_phase Internal: execute chroot phase
Options:
--config FILE Use specified config file
--dry-run Simulate installation without destructive operations
--force Continue past failed prerequisite checks
--non-interactive Abort on any error (no recovery menu)
--help Show this help message
EOF
}
while [[ $# -gt 0 ]]; do
case "$1" in
--configure)
MODE="configure"
shift
;;
--install)
MODE="install"
shift
;;
--resume)
MODE="resume"
shift
;;
__chroot_phase)
MODE="chroot"
shift
;;
--config)
if [[ $# -lt 2 ]]; then
die "--config requires a file argument"
fi
CONFIG_FILE="$2"
shift 2
;;
--dry-run)
DRY_RUN=1
shift
;;
--force)
FORCE=1
shift
;;
--non-interactive)
NON_INTERACTIVE=1
shift
;;
--help|-h)
usage
exit 0
;;
*)
eerror "Unknown argument: $1"
usage
exit 1
;;
esac
done
# --- Main functions ---
# run_configuration_wizard — Launch all TUI screens
run_configuration_wizard() {
init_dialog
register_wizard_screens \
screen_welcome \
screen_preset_load \
screen_hw_detect \
screen_wifi_config \
screen_disk_select \
screen_filesystem_select \
screen_swap_config \
screen_network_config \
screen_locale_config \
screen_kernel_select \
screen_secureboot_config \
screen_gpu_config \
screen_desktop_select \
screen_desktop_config \
screen_user_config \
screen_extra_packages \
screen_preset_save \
screen_summary
run_wizard
config_save "${CONFIG_FILE}"
einfo "Configuration complete. Saved to ${CONFIG_FILE}"
}
# run_chroot_phase — Execute inside chroot (re-invoked by install.sh __chroot_phase)
run_chroot_phase() {
if [[ "${_IN_CHROOT:-0}" == "1" ]]; then
_do_chroot_phases
else
# Re-invoke ourselves inside chroot
chroot_exec "${CHROOT_INSTALLER_DIR}/install.sh" __chroot_phase \
--config "${CHROOT_INSTALLER_DIR}/$(basename "${CONFIG_FILE}")"
fi
}
# _do_chroot_phases — Actual chroot work
_do_chroot_phases() {
export _IN_CHROOT=1
einfo "=== Chroot installation phases ==="
# Phase 5: XBPS update + base-system
if ! checkpoint_reached "xbps_update"; then
einfo "--- Phase: XBPS update ---"
maybe_exec 'before_xbps_update'
xbps_update
maybe_exec 'after_xbps_update'
checkpoint_set "xbps_update"
else
einfo "Skipping xbps update (checkpoint reached)"
fi
# Phase 6: System config
if ! checkpoint_reached "system_config"; then
einfo "--- Phase: System configuration ---"
maybe_exec 'before_system_config'
system_set_timezone
system_set_locale
system_set_hostname
system_set_keymap
maybe_exec 'after_system_config'
checkpoint_set "system_config"
else
einfo "Skipping system config (checkpoint reached)"
fi
# Phase 6b: Users — deliberately BEFORE kernel/desktop.
# These are the longest and most failure-prone phases; when one of them
# failed the users phase never ran, leaving root with the ROOTFS's locked
# '*' password and no user account: an unloginnable system (no user for
# SDDM/GDM, SSH root blocked). This locked out a real GPD Pocket 4 in the
# Gentoo installer. Creating accounts first also means /etc/skel configs
# written later by the desktop phase can be copied into a real home.
if ! checkpoint_reached "users"; then
einfo "--- Phase: Users ---"
maybe_exec 'before_users'
system_create_users
maybe_exec 'after_users'
checkpoint_set "users"
else
einfo "Skipping users (checkpoint reached)"
fi
# Phase 7: Kernel
if ! checkpoint_reached "kernel"; then
einfo "--- Phase: Kernel ---"
maybe_exec 'before_kernel'
kernel_install
maybe_exec 'after_kernel'
checkpoint_set "kernel" "${KERNEL_TYPE:-mainline}"
else
einfo "Skipping kernel (checkpoint reached)"
fi
# Phase 8: Filesystem tools + fstab
if ! checkpoint_reached "fstab"; then
einfo "--- Phase: Filesystem tools and fstab ---"
maybe_exec 'before_fstab'
install_filesystem_tools
generate_fstab
# crypttab + dracut + keyfile: after the kernel (dracut needs modules),
# before the bootloader (GRUB config reads the LUKS UUID).
luks_configure_system
# LAST in this phase, deliberately: it is the only step here that hits the
# network (xbps-install cronie), and an abort between generate_fstab and
# luks_configure_system would leave the target without /etc/fstab or
# /etc/crypttab — i.e. unbootable — for the sake of a maintenance job.
setup_periodic_trim
maybe_exec 'after_fstab'
checkpoint_set "fstab"
else
einfo "Skipping fstab (checkpoint reached)"
fi
# Phase 9: Networking
if ! checkpoint_reached "networking"; then
einfo "--- Phase: Networking ---"
maybe_exec 'before_networking'
install_network_manager
maybe_exec 'after_networking'
checkpoint_set "networking"
else
einfo "Skipping networking (checkpoint reached)"
fi
# Phase 10: Bootloader
if ! checkpoint_reached "bootloader"; then
einfo "--- Phase: Bootloader ---"
maybe_exec 'before_bootloader'
bootloader_install
maybe_exec 'after_bootloader'
checkpoint_set "bootloader"
else
einfo "Skipping bootloader (checkpoint reached)"
fi
# Phase 10a: Btrfs snapshots — after the bootloader, because grub-btrfs
# generates GRUB menu entries and needs GRUB already installed.
if ! checkpoint_reached "snapshots"; then
einfo "--- Phase: Snapshots ---"
maybe_exec 'before_snapshots'
snapper_setup
maybe_exec 'after_snapshots'
checkpoint_set "snapshots"
else
einfo "Skipping snapshots (checkpoint reached)"
fi
# Phase 10b: Secure Boot
if ! checkpoint_reached "secureboot"; then
einfo "--- Phase: Secure Boot ---"
maybe_exec 'before_secureboot'
secureboot_setup
maybe_exec 'after_secureboot'
checkpoint_set "secureboot"
else
einfo "Skipping secureboot (checkpoint reached)"
fi
# Phase 11: Swap
if ! checkpoint_reached "swap_setup"; then
einfo "--- Phase: Swap ---"
maybe_exec 'before_swap'
swap_setup
maybe_exec 'after_swap'
checkpoint_set "swap_setup"
else
einfo "Skipping swap setup (checkpoint reached)"
fi
# Phase 12: Desktop
if ! checkpoint_reached "desktop"; then
einfo "--- Phase: Desktop ---"
maybe_exec 'before_desktop'
desktop_install
maybe_exec 'after_desktop'
checkpoint_set "desktop"
else
einfo "Skipping desktop (checkpoint reached)"
fi
# Phase 14: Extras
if ! checkpoint_reached "extras"; then
einfo "--- Phase: Extra packages ---"
maybe_exec 'before_extras'
xbps_install_base
install_extra_packages
install_power_management
configure_flatpak
# After extras: a package chosen there can still pull in Xorg,
# so the Wayland-only claim is verified, not assumed.
verify_wayland_only
install_hyprland_ecosystem
install_niri_ecosystem
install_noctalia_shell
install_gaming
install_fingerprint_tools
install_thunderbolt_tools
install_sensor_tools
install_wwan_tools
install_asusctl_tools
install_surface_tools
maybe_exec 'after_extras'
checkpoint_set "extras"
else
einfo "Skipping extras (checkpoint reached)"
fi
# Phase 15: UMPC quirks (panel rotation cmdline already set in bootloader;
# this phase installs runtime services like ALC287 unmute, SDDM greeter
# rotation, and the POST-INSTALL note for gpd-fan-daemon). Skipped silently
# when no UMPC is detected, so cost is zero for normal hardware.
if ! checkpoint_reached "umpc_quirks"; then
einfo "--- Phase: UMPC quirks ---"
maybe_exec 'before_umpc_quirks'
umpc_apply_quirks
maybe_exec 'after_umpc_quirks'
checkpoint_set "umpc_quirks"
else
einfo "Skipping UMPC quirks (checkpoint reached)"
fi
# Phase 15b: Apple quirks (Broadcom bluetooth firmware, Wi-Fi profile
# carry-over, post-install notes). The module/dracut config is written
# earlier, inside kernel_install, because it has to precede the initramfs.
if ! checkpoint_reached "apple_quirks"; then
einfo "--- Phase: Apple quirks ---"
maybe_exec 'before_apple_quirks'
apple_apply_quirks
maybe_exec 'after_apple_quirks'
checkpoint_set "apple_quirks"
else
einfo "Skipping Apple quirks (checkpoint reached)"
fi
# Phase 16: Finalize
if ! checkpoint_reached "finalize"; then
einfo "--- Phase: Finalization ---"
maybe_exec 'before_finalize'
system_finalize
maybe_exec 'after_finalize'
checkpoint_set "finalize"
else
einfo "Skipping finalization (checkpoint reached)"
fi
einfo "=== All chroot phases complete ==="
}
# run_post_install — Final steps after chroot
run_post_install() {
einfo "=== Post-installation ==="
# Copy bundled gum binary to target system (not in Void repos, needed for dotfiles wizard)
_install_gum_to_target
# Steps the user chose to skip after a failure — the install may be
# incomplete and nothing else would say so.
local skipped_report=""
local target_skipped="${MOUNTPOINT}/var/log/void-installer-skipped.log"
if [[ -s "${target_skipped}" ]]; then
skipped_report=$(cut -f2 "${target_skipped}" 2>/dev/null | sort -u | sed 's/^/ - /') || true
fi
# The outer process (disks/ROOTFS/mount) logs to tmpfs — keep a copy on the
# installed system. Separate file so it cannot clobber the chroot log.
if [[ "${DRY_RUN:-0}" != "1" ]] && mountpoint -q "${MOUNTPOINT}" 2>/dev/null; then
mkdir -p "${MOUNTPOINT}/var/log" 2>/dev/null || true
cp "${LOG_FILE}" "${MOUNTPOINT}/var/log/void-installer-outer.log" 2>/dev/null || true
fi
if [[ -n "${skipped_report}" ]]; then
dialog_msgbox "Installation Incomplete" \
"SOME STEPS WERE SKIPPED after a failure (you chose 'continue').\n\n\
The system may be INCOMPLETE — finish these manually\n\
(full list in /var/log/void-installer-skipped.log):\n\n\
${skipped_report}" || true
ewarn "Skipped steps recorded in /var/log/void-installer-skipped.log"
fi
# Unmount everything
unmount_filesystems
if dialog_yesno "Reboot" "Would you like to reboot now?"; then
einfo "Rebooting..."
if [[ "${DRY_RUN}" != "1" ]]; then
reboot
else
einfo "[DRY-RUN] Would reboot now"
fi
else
einfo "You can reboot manually when ready."
einfo "Log file: ${LOG_FILE}"
fi
}
# preflight_checks — Verify system readiness
preflight_checks() {
einfo "Running preflight checks..."
if [[ "${DRY_RUN}" != "1" ]]; then
is_root || die "Must run as root"
is_efi || die "UEFI boot mode required"
ensure_dns
has_network || die "Network connectivity required"
fi
# Ensure required tools are available (Void base ISO is very minimal)
if [[ "${DRY_RUN}" != "1" ]]; then
local -a _missing_pkgs=()
command -v curl &>/dev/null || _missing_pkgs+=(curl)
command -v xz &>/dev/null || _missing_pkgs+=(xz)
if (( ${#_missing_pkgs[@]} > 0 )); then
einfo "Installing missing tools: ${_missing_pkgs[*]}..."
xbps-install -Sy "${_missing_pkgs[@]}" >/dev/null 2>&1 || true
fi
fi
# Sync clock (skip if NTP daemon already running). A wrong clock makes
# every HTTPS download fail (TLS cert validity window) — so after the
# best-effort sync we sanity-check the year and warn loudly if it is still
# implausible instead of letting curl fail cryptically later.
if [[ "${DRY_RUN}" != "1" ]]; then
if pgrep -x chronyd &>/dev/null || pgrep -x ntpd &>/dev/null; then
einfo "NTP daemon already running, clock should be synced"
elif command -v chronyc &>/dev/null; then
chronyc makestep &>/dev/null || chronyd -q &>/dev/null || true
einfo "Clock synced via chrony"
elif command -v ntpdate &>/dev/null; then
try "Syncing system clock" ntpdate pool.ntp.org || true
elif command -v ntpd &>/dev/null; then
try "Syncing system clock" ntpd -q -g || true
else
ewarn "No NTP client found — cannot sync clock automatically"
fi
local _year
_year=$(date -u +%Y 2>/dev/null || echo 0)
if [[ "${_year}" -lt 2024 ]]; then
ewarn "System clock looks wrong (year=${_year}). HTTPS downloads"
ewarn "(ROOTFS, mirrors, shim) may fail TLS validation. Set the"
ewarn "clock manually: date -u MMDDhhmmYYYY"
fi
fi
einfo "Preflight checks passed"
}
# --- Entry point ---
main() {
# The chroot phase must log somewhere that survives a reboot: /tmp is
# tmpfs, so after a crash + reboot + --resume there was NO log left —
# precisely when it is needed most. /var/log is on the target filesystem.
if [[ "${MODE}" == "chroot" && "${DRY_RUN:-0}" != "1" ]]; then
LOG_FILE="/var/log/void-installer.log"
LOG_APPEND=1
SKIPPED_LOG="/var/log/void-installer-skipped.log"
fi
init_logging
einfo "========================================="
einfo "${INSTALLER_NAME} v${INSTALLER_VERSION}"
einfo "========================================="
einfo "Mode: ${MODE}"
[[ "${DRY_RUN}" == "1" ]] && ewarn "DRY-RUN mode enabled"
case "${MODE}" in
full)
run_configuration_wizard
screen_progress
run_post_install
;;
configure)
run_configuration_wizard
;;
install)
config_load "${CONFIG_FILE}"
deserialize_detected_oses
init_dialog
screen_progress
run_post_install
;;
resume)
local resume_rc=0
try_resume_from_disk || resume_rc=$?
case ${resume_rc} in
0)
# Config + checkpoints recovered
config_load "${CONFIG_FILE}"
deserialize_detected_oses
init_dialog
# Show recovered checkpoints
local completed_list=""
local cp_name
for cp_name in "${CHECKPOINTS[@]}"; do
if checkpoint_reached "${cp_name}"; then
completed_list+=" - ${cp_name}\n"
fi
done
dialog_msgbox "Resume: Data Recovered" \
"Found previous installation on ${RESUME_FOUND_PARTITION}.\n\nRecovered config and checkpoints:\n\n${completed_list}\nResuming installation..."
screen_progress
run_post_install
;;
1)
# Only checkpoints, no config — try inference from partition
init_dialog
local infer_rc=0
infer_config_from_partition "${RESUME_FOUND_PARTITION}" "${RESUME_FOUND_FSTYPE}" || infer_rc=$?
if [[ ${infer_rc} -eq 0 ]]; then
# Sufficient config inferred — save and proceed
config_save "${CONFIG_FILE}"
local inferred_summary=""
inferred_summary+="Partition: ${ROOT_PARTITION:-?}\n"
inferred_summary+="Disk: ${TARGET_DISK:-?}\n"
inferred_summary+="Filesystem: ${FILESYSTEM:-?}\n"
inferred_summary+="ESP: ${ESP_PARTITION:-?}\n"
[[ -n "${HOSTNAME:-}" ]] && inferred_summary+="Hostname: ${HOSTNAME}\n"
[[ -n "${TIMEZONE:-}" ]] && inferred_summary+="Timezone: ${TIMEZONE}\n"
[[ -n "${LOCALE:-}" ]] && inferred_summary+="Locale: ${LOCALE}\n"
[[ -n "${KERNEL_TYPE:-}" ]] && inferred_summary+="Kernel: ${KERNEL_TYPE}\n"
[[ -n "${GPU_VENDOR:-}" ]] && inferred_summary+="GPU: ${GPU_VENDOR}\n"
local completed_list=""
local cp_name
for cp_name in "${CHECKPOINTS[@]}"; do
if checkpoint_reached "${cp_name}"; then
completed_list+=" - ${cp_name}\n"
fi
done
dialog_msgbox "Resume: Config Inferred" \
"Found checkpoints on ${RESUME_FOUND_PARTITION} (no config file).\n\nInferred configuration:\n${inferred_summary}\nCompleted phases:\n${completed_list}\nResuming installation..."
screen_progress
run_post_install
else
# Partial inference — pre-filled wizard
dialog_msgbox "Resume: Partial Recovery" \
"Found checkpoints on ${RESUME_FOUND_PARTITION} but could not fully infer configuration.\n\nSome fields have been pre-filled from the installed system.\nPlease complete the wizard. Completed phases will be skipped automatically."
run_configuration_wizard
screen_progress
run_post_install
fi
;;
2)
# Nothing found — fall back to full mode
init_dialog
dialog_msgbox "Resume: Nothing Found" \
"No previous installation data found on any partition.\n\nStarting full installation."
run_configuration_wizard
screen_progress
run_post_install
;;
esac
;;
chroot)
# Running inside chroot
export _IN_CHROOT=1
config_load "${CONFIG_FILE}"
deserialize_detected_oses
_do_chroot_phases
;;
*)
die "Unknown mode: ${MODE}"
;;
esac
einfo "Done."
}
main "$@"