fix: route customization errors through recovery menu instead of error_handler

Previously, when a container was stopped or base package installation
failed during 'Customizing LXC Container', the error handler's simple
'Remove broken container? (Y/n)' prompt appeared instead of the full
recovery menu with retry/repair options (verbose rebuild, APT repair,
OOM retry, DNS override).

Root cause: set -Eeuo pipefail and ERR trap were still active during
the customization phase (locale, timezone, base packages). The exit 1
triggered error_handler() which has its own cleanup flow, bypassing
the full recovery menu in build_container().

Changes:
- Disable ERR trap before customization phase (not just before lxc-attach)
- Replace exit 1 with install_exit_code=1 for base package failures
- Wrap lxc-attach section in if-block that skips when customization failed
- Both customization and install errors now reach the full recovery menu
- Fix read in error_handler.func to use </dev/tty (same curl stdin issue)
- Eliminates 'pop_var_context: head of shell_variables not a function
  context' bash error caused by double-exit (exit 1 -> ERR trap -> exit)
This commit is contained in:
CanbiZ (MickLesk)
2026-02-28 08:41:31 +01:00
parent 10400e5c56
commit e80241745f
2 changed files with 66 additions and 56 deletions

View File

@@ -286,7 +286,7 @@ error_handler() {
echo -en "${YW}Remove broken container ${CTID}? (Y/n) [auto-remove in 60s]: ${CL}"
fi
if read -t 60 -r response; then
if read -t 60 -r response </dev/tty; then
if [[ -z "$response" || "$response" =~ ^[Yy]$ ]]; then
echo ""
if declare -f msg_info >/dev/null 2>&1; then