Improve container install error handling and logging

Enhances reliability of application installation error detection in containers by using an error flag file, improves log copying and user prompts, and updates error handler to create a flag file with the exit code for host-side detection.
This commit is contained in:
CanbiZ
2025-11-17 12:23:51 +01:00
parent 5386da93e8
commit 06a4091019
2 changed files with 35 additions and 12 deletions

View File

@@ -205,6 +205,10 @@ error_handler() {
if [[ -d /root ]]; then
local container_log="/root/.install-${SESSION_ID:-error}.log"
cp "$SILENT_LOGFILE" "$container_log" 2>/dev/null || true
# Create error flag file with exit code for host detection
echo "$exit_code" > "/root/.install-${SESSION_ID:-error}.failed" 2>/dev/null || true
if declare -f msg_custom >/dev/null 2>&1; then
msg_custom "📋" "${YW}" "Log saved to: ${container_log}"
else