Improve install log handling for containers

Enhances the build and error handler scripts to better manage installation logs. On install failure, the log is now copied from the container to the host for easier debugging. The error handler now saves the log inside the container's /root directory for later retrieval, improving traceability and support.
This commit is contained in:
CanbiZ
2025-11-04 17:10:28 +01:00
parent dd34f2d8b3
commit 27bb9e5192
2 changed files with 14 additions and 14 deletions

View File

@@ -2518,7 +2518,12 @@ EOF'
# Run application installer
if ! lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/install/${var_install}.sh)"; then
exit $?
local exit_code=$?
# Try to copy installation log from container before exiting
if [[ -n "$CTID" && -n "${SESSION_ID:-}" ]]; then
pct pull "$CTID" "/root/.install-${SESSION_ID}.log" "/tmp/install-${SESSION_ID}.log" 2>/dev/null || true
fi
exit $exit_code
fi
}