From d24210053100c482f92961b952e9c0112cfe6aac Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Tue, 3 Mar 2026 14:10:03 +0100 Subject: [PATCH] refactor(preflight): move to install_script, clean UX flow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Move run_preflight from build_container() into install_script() after header_info - Shows: Header → preflight checks → 2s pause → clear (via next header_info call) - On failure: show summary + exit cleanly (no ERR trap) - Change all return 1 → return 0 in preflight functions (prevents ERR trap under set -Ee) - Remove PREFLIGHT_DONE guard from build_container (no longer needed) --- misc/build.func | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/misc/build.func b/misc/build.func index d7bf1ef8..03c49c48 100644 --- a/misc/build.func +++ b/misc/build.func @@ -540,9 +540,9 @@ preflight_template_available() { # # - Executes all preflight checks and collects results # - Displays a summary with pass/fail/warn counts -# - On failure: reports to telemetry with "aborted" status and exits -# - On success: continues with brief confirmation -# - Called from install_script() after diagnostics_check() +# - On failure: reports to telemetry with "aborted" status and exits cleanly +# - On success: brief pause (2s) then returns (caller shows next screen) +# - Called from install_script() after header_info() # ------------------------------------------------------------------------------ run_preflight() { # Reset counters @@ -599,13 +599,13 @@ run_preflight() { exit "$PREFLIGHT_EXIT_CODE" fi - # Success + # Success — brief pause so user can see results, then clear for next screen if [[ "$PREFLIGHT_WARNINGS" -gt 0 ]]; then echo -e "${CM}${BOLD}${GN} Pre-flight passed with ${PREFLIGHT_WARNINGS} warning(s) (${PREFLIGHT_PASSED} checks passed)${CL}" else echo -e "${CM}${BOLD}${GN} All pre-flight checks passed (${PREFLIGHT_PASSED}/${PREFLIGHT_PASSED})${CL}" fi - echo "" + sleep 2 } # ============================================================================== @@ -3461,8 +3461,9 @@ install_script() { fi [[ "${timezone:-}" == Etc/* ]] && timezone="host" # pct doesn't accept Etc/* zones - # Show APP Header + # Show APP Header + run preflight checks header_info + run_preflight # --- Support CLI argument as direct preset (default, advanced, …) --- CHOICE="${mode:-${1:-}}" @@ -3992,12 +3993,6 @@ start() { build_container() { # if [ "$VERBOSE" == "yes" ]; then set -x; fi - # Run preflight checks once (skipped on recursive retry calls) - if [[ "${PREFLIGHT_DONE:-}" != "true" ]]; then - run_preflight - PREFLIGHT_DONE=true - fi - NET_STRING="-net0 name=eth0,bridge=${BRG:-vmbr0}" # MAC