mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-07-21 21:35:08 +02:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7a76d94745 | |||
| b4030cef3a | |||
| a35e496d93 |
+1
-14
@@ -505,26 +505,14 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
|
|||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
## 2026-07-21
|
|
||||||
|
|
||||||
### 🚀 Updated Scripts
|
|
||||||
|
|
||||||
- #### ✨ New Features
|
|
||||||
|
|
||||||
- Pangolin: Bump Version to 1.21.0 [@MickLesk](https://github.com/MickLesk) ([#15938](https://github.com/community-scripts/ProxmoxVE/pull/15938))
|
|
||||||
|
|
||||||
- #### 🔧 Refactor
|
|
||||||
|
|
||||||
- Standardize CT update backup handling [@MickLesk](https://github.com/MickLesk) ([#15937](https://github.com/community-scripts/ProxmoxVE/pull/15937))
|
|
||||||
|
|
||||||
## 2026-07-20
|
## 2026-07-20
|
||||||
|
|
||||||
### 🚀 Updated Scripts
|
### 🚀 Updated Scripts
|
||||||
|
|
||||||
- #### 🐞 Bug Fixes
|
- #### 🐞 Bug Fixes
|
||||||
|
|
||||||
- RomM: use backup helpers in update / clear folder [@MickLesk](https://github.com/MickLesk) ([#15915](https://github.com/community-scripts/ProxmoxVE/pull/15915))
|
|
||||||
- fix: vikunja: asset selection [@CrazyWolf13](https://github.com/CrazyWolf13) ([#15929](https://github.com/community-scripts/ProxmoxVE/pull/15929))
|
- fix: vikunja: asset selection [@CrazyWolf13](https://github.com/CrazyWolf13) ([#15929](https://github.com/community-scripts/ProxmoxVE/pull/15929))
|
||||||
|
- RomM: use backup helpers in update / clear folder [@MickLesk](https://github.com/MickLesk) ([#15915](https://github.com/community-scripts/ProxmoxVE/pull/15915))
|
||||||
- Zammad : bind Elasticsearch to 127.0.0.1 [@MickLesk](https://github.com/MickLesk) ([#15909](https://github.com/community-scripts/ProxmoxVE/pull/15909))
|
- Zammad : bind Elasticsearch to 127.0.0.1 [@MickLesk](https://github.com/MickLesk) ([#15909](https://github.com/community-scripts/ProxmoxVE/pull/15909))
|
||||||
- Omada: fix package version extraction [@MickLesk](https://github.com/MickLesk) ([#15908](https://github.com/community-scripts/ProxmoxVE/pull/15908))
|
- Omada: fix package version extraction [@MickLesk](https://github.com/MickLesk) ([#15908](https://github.com/community-scripts/ProxmoxVE/pull/15908))
|
||||||
- fix(wanderer): use PocketBase-relative plugin symlink in unprivileged LXC [@michelroegl-brunner](https://github.com/michelroegl-brunner) ([#15911](https://github.com/community-scripts/ProxmoxVE/pull/15911))
|
- fix(wanderer): use PocketBase-relative plugin symlink in unprivileged LXC [@michelroegl-brunner](https://github.com/michelroegl-brunner) ([#15911](https://github.com/community-scripts/ProxmoxVE/pull/15911))
|
||||||
@@ -541,7 +529,6 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
|
|||||||
|
|
||||||
- #### ✨ New Features
|
- #### ✨ New Features
|
||||||
|
|
||||||
- core: refactor to single-reporter telemetry and better error_handling [@MickLesk](https://github.com/MickLesk) ([#15933](https://github.com/community-scripts/ProxmoxVE/pull/15933))
|
|
||||||
- tools.func: add support for extracting 7z archives [@MickLesk](https://github.com/MickLesk) ([#15919](https://github.com/community-scripts/ProxmoxVE/pull/15919))
|
- tools.func: add support for extracting 7z archives [@MickLesk](https://github.com/MickLesk) ([#15919](https://github.com/community-scripts/ProxmoxVE/pull/15919))
|
||||||
- Meilisearch : use dumpless Meilisearch upgrades [@MickLesk](https://github.com/MickLesk) ([#15921](https://github.com/community-scripts/ProxmoxVE/pull/15921))
|
- Meilisearch : use dumpless Meilisearch upgrades [@MickLesk](https://github.com/MickLesk) ([#15921](https://github.com/community-scripts/ProxmoxVE/pull/15921))
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV
|
|||||||
# Source: https://pangolin.net/ | Github: https://github.com/fosrl/pangolin
|
# Source: https://pangolin.net/ | Github: https://github.com/fosrl/pangolin
|
||||||
|
|
||||||
APP="Pangolin"
|
APP="Pangolin"
|
||||||
PANGOLIN_VERSION="${PANGOLIN_VERSION:-1.21.0}"
|
PANGOLIN_VERSION="${PANGOLIN_VERSION:-1.20.0}"
|
||||||
var_tags="${var_tags:-proxy}"
|
var_tags="${var_tags:-proxy}"
|
||||||
var_cpu="${var_cpu:-2}"
|
var_cpu="${var_cpu:-2}"
|
||||||
var_ram="${var_ram:-4096}"
|
var_ram="${var_ram:-4096}"
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ msg_ok "Installed Dependencies"
|
|||||||
NODE_VERSION="24" setup_nodejs
|
NODE_VERSION="24" setup_nodejs
|
||||||
PG_VERSION="17" setup_postgresql
|
PG_VERSION="17" setup_postgresql
|
||||||
PG_DB_NAME="pangolin" PG_DB_USER="pangolin" setup_postgresql_db
|
PG_DB_NAME="pangolin" PG_DB_USER="pangolin" setup_postgresql_db
|
||||||
PANGOLIN_VERSION="${PANGOLIN_VERSION:-1.21.0}"
|
PANGOLIN_VERSION="${PANGOLIN_VERSION:-1.20.0}"
|
||||||
fetch_and_deploy_gh_release "pangolin" "fosrl/pangolin" "tarball" "$PANGOLIN_VERSION"
|
fetch_and_deploy_gh_release "pangolin" "fosrl/pangolin" "tarball" "$PANGOLIN_VERSION"
|
||||||
fetch_and_deploy_gh_release "gerbil" "fosrl/gerbil" "singlefile" "latest" "/usr/bin" "gerbil_linux_$(arch_resolve)"
|
fetch_and_deploy_gh_release "gerbil" "fosrl/gerbil" "singlefile" "latest" "/usr/bin" "gerbil_linux_$(arch_resolve)"
|
||||||
fetch_and_deploy_gh_release "traefik" "traefik/traefik" "prebuild" "latest" "/usr/bin" "traefik_v*_linux_$(arch_resolve).tar.gz"
|
fetch_and_deploy_gh_release "traefik" "traefik/traefik" "prebuild" "latest" "/usr/bin" "traefik_v*_linux_$(arch_resolve).tar.gz"
|
||||||
|
|||||||
@@ -6,10 +6,6 @@
|
|||||||
if ! command -v curl >/dev/null 2>&1; then
|
if ! command -v curl >/dev/null 2>&1; then
|
||||||
apk update && apk add curl >/dev/null 2>&1
|
apk update && apk add curl >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
# Mark container context BEFORE error handling starts: error_handler/on_exit
|
|
||||||
# must write local failure artifacts instead of talking to the telemetry API
|
|
||||||
# (the host is the single telemetry reporter).
|
|
||||||
export TELEMETRY_CONTEXT="container"
|
|
||||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func)
|
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func)
|
||||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/error_handler.func)
|
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/error_handler.func)
|
||||||
load_functions
|
load_functions
|
||||||
@@ -45,7 +41,7 @@ post_progress_to_api() {
|
|||||||
|
|
||||||
curl -fsS -m 5 -X POST "https://telemetry.community-scripts.org/telemetry" \
|
curl -fsS -m 5 -X POST "https://telemetry.community-scripts.org/telemetry" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{\"random_id\":\"${RANDOM_UUID}\",\"execution_id\":\"${EXECUTION_ID:-${RANDOM_UUID}}\",\"type\":\"lxc\",\"nsapp\":\"${app:-unknown}\",\"status\":\"${progress_status}\",\"platform\":\"${TELEMETRY_PLATFORM:-}\",\"repo_source\":\"${REPO_SOURCE:-}\",\"repo_slug\":\"${REPO_SLUG:-}\"}" &>/dev/null || true
|
-d "{\"random_id\":\"${RANDOM_UUID}\",\"execution_id\":\"${EXECUTION_ID:-${RANDOM_UUID}}\",\"type\":\"lxc\",\"nsapp\":\"${app:-unknown}\",\"status\":\"${progress_status}\"}" &>/dev/null || true
|
||||||
}
|
}
|
||||||
|
|
||||||
# This function enables IPv6 if it's not disabled and sets verbose mode
|
# This function enables IPv6 if it's not disabled and sets verbose mode
|
||||||
|
|||||||
+827
-547
File diff suppressed because it is too large
Load Diff
@@ -4072,11 +4072,6 @@ build_container() {
|
|||||||
export RANDOM_UUID="$RANDOM_UUID"
|
export RANDOM_UUID="$RANDOM_UUID"
|
||||||
export EXECUTION_ID="$EXECUTION_ID"
|
export EXECUTION_ID="$EXECUTION_ID"
|
||||||
export SESSION_ID="$SESSION_ID"
|
export SESSION_ID="$SESSION_ID"
|
||||||
# Repo attribution + platform for container-side progress pings (the
|
|
||||||
# container inherits the host's detection instead of re-detecting)
|
|
||||||
export REPO_SOURCE="${REPO_SOURCE:-}"
|
|
||||||
export REPO_SLUG="${REPO_SLUG:-}"
|
|
||||||
export TELEMETRY_PLATFORM="pve"
|
|
||||||
export CACHER="$APT_CACHER"
|
export CACHER="$APT_CACHER"
|
||||||
export CACHER_IP="$APT_CACHER_IP"
|
export CACHER_IP="$APT_CACHER_IP"
|
||||||
if [[ -n "${HTTP_PROXY:-}" ]]; then
|
if [[ -n "${HTTP_PROXY:-}" ]]; then
|
||||||
@@ -4900,16 +4895,6 @@ EOF
|
|||||||
# Point INSTALL_LOG to combined log so get_full_log() finds it
|
# Point INSTALL_LOG to combined log so get_full_log() finds it
|
||||||
INSTALL_LOG="$combined_log"
|
INSTALL_LOG="$combined_log"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Pull the structured error capture (.errinfo) from the container.
|
|
||||||
# It contains EXACTLY the output of the command that failed (written by
|
|
||||||
# silent()/error_handler inside the container) and is the primary source
|
|
||||||
# for the telemetry error trace - instead of a generic log tail.
|
|
||||||
local host_errinfo="/tmp/.errinfo-${SESSION_ID}"
|
|
||||||
if timeout 8 pct pull "$CTID" "/root/.install-${SESSION_ID}.log.errinfo" "$host_errinfo" 2>/dev/null && [[ -s "$host_errinfo" ]]; then
|
|
||||||
TELEMETRY_ERRINFO="$host_errinfo"
|
|
||||||
export TELEMETRY_ERRINFO
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Defense-in-depth: Ensure error handling stays disabled during recovery.
|
# Defense-in-depth: Ensure error handling stays disabled during recovery.
|
||||||
@@ -5185,8 +5170,6 @@ EOF
|
|||||||
echo -e " Verbose: ${GN}enabled${CL}"
|
echo -e " Verbose: ${GN}enabled${CL}"
|
||||||
echo ""
|
echo ""
|
||||||
msg_info "Restarting installation..."
|
msg_info "Restarting installation..."
|
||||||
# New telemetry execution for the retry (previous one keeps its "failed")
|
|
||||||
declare -f telemetry_new_attempt &>/dev/null && telemetry_new_attempt
|
|
||||||
# Re-run build_container
|
# Re-run build_container
|
||||||
build_container
|
build_container
|
||||||
return $?
|
return $?
|
||||||
@@ -5226,10 +5209,6 @@ EOF
|
|||||||
echo ""
|
echo ""
|
||||||
msg_info "Re-running installation script..."
|
msg_info "Re-running installation script..."
|
||||||
|
|
||||||
# New telemetry execution for the in-place retry
|
|
||||||
declare -f telemetry_new_attempt &>/dev/null && telemetry_new_attempt
|
|
||||||
declare -f post_to_api &>/dev/null && post_to_api 2>/dev/null || true
|
|
||||||
|
|
||||||
# Re-run install script in existing container (don't destroy/recreate)
|
# Re-run install script in existing container (don't destroy/recreate)
|
||||||
set +Eeuo pipefail
|
set +Eeuo pipefail
|
||||||
trap - ERR
|
trap - ERR
|
||||||
@@ -5293,7 +5272,6 @@ EOF
|
|||||||
echo -e " Verbose: ${GN}enabled${CL}"
|
echo -e " Verbose: ${GN}enabled${CL}"
|
||||||
echo ""
|
echo ""
|
||||||
msg_info "Restarting installation..."
|
msg_info "Restarting installation..."
|
||||||
declare -f telemetry_new_attempt &>/dev/null && telemetry_new_attempt
|
|
||||||
build_container
|
build_container
|
||||||
return $?
|
return $?
|
||||||
fi
|
fi
|
||||||
@@ -5323,7 +5301,6 @@ EOF
|
|||||||
echo -e " Verbose: ${GN}enabled${CL}"
|
echo -e " Verbose: ${GN}enabled${CL}"
|
||||||
echo ""
|
echo ""
|
||||||
msg_info "Restarting installation..."
|
msg_info "Restarting installation..."
|
||||||
declare -f telemetry_new_attempt &>/dev/null && telemetry_new_attempt
|
|
||||||
build_container
|
build_container
|
||||||
return $?
|
return $?
|
||||||
fi
|
fi
|
||||||
@@ -5348,7 +5325,6 @@ EOF
|
|||||||
echo -e " Verbose: ${GN}enabled${CL}"
|
echo -e " Verbose: ${GN}enabled${CL}"
|
||||||
echo ""
|
echo ""
|
||||||
msg_info "Restarting installation..."
|
msg_info "Restarting installation..."
|
||||||
declare -f telemetry_new_attempt &>/dev/null && telemetry_new_attempt
|
|
||||||
build_container
|
build_container
|
||||||
return $?
|
return $?
|
||||||
fi
|
fi
|
||||||
@@ -7023,16 +6999,6 @@ ensure_log_on_host() {
|
|||||||
rm -f "$temp_log"
|
rm -f "$temp_log"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# Also pull the structured error capture (.errinfo) so the telemetry error
|
|
||||||
# trace shows the failing command's exact output (signal-exit paths reach
|
|
||||||
# this via on_exit before/instead of the recovery flow)
|
|
||||||
if [[ -z "${TELEMETRY_ERRINFO:-}" || ! -s "${TELEMETRY_ERRINFO:-}" ]]; then
|
|
||||||
local host_errinfo="/tmp/.errinfo-${SESSION_ID}"
|
|
||||||
if timeout 8 pct pull "$CTID" "/root/.install-${SESSION_ID}.log.errinfo" "$host_errinfo" 2>/dev/null && [[ -s "$host_errinfo" ]]; then
|
|
||||||
TELEMETRY_ERRINFO="$host_errinfo"
|
|
||||||
export TELEMETRY_ERRINFO
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [[ -s "$combined_log" ]]; then
|
if [[ -s "$combined_log" ]]; then
|
||||||
INSTALL_LOG="$combined_log"
|
INSTALL_LOG="$combined_log"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -546,12 +546,6 @@ silent() {
|
|||||||
set +Eeuo pipefail
|
set +Eeuo pipefail
|
||||||
trap - ERR
|
trap - ERR
|
||||||
|
|
||||||
# Byte offset BEFORE the command runs - everything the log grows by is
|
|
||||||
# exactly this command's output (used for the .errinfo telemetry capture)
|
|
||||||
local start_bytes=0
|
|
||||||
[[ -f "$logfile" ]] && start_bytes=$(stat -c%s "$logfile" 2>/dev/null || echo 0)
|
|
||||||
[[ ! "$start_bytes" =~ ^[0-9]+$ ]] && start_bytes=0
|
|
||||||
|
|
||||||
"$@" >>"$logfile" 2>&1
|
"$@" >>"$logfile" 2>&1
|
||||||
local rc=$?
|
local rc=$?
|
||||||
|
|
||||||
@@ -573,43 +567,12 @@ silent() {
|
|||||||
export _SILENT_FAILED_LINE="$caller_line"
|
export _SILENT_FAILED_LINE="$caller_line"
|
||||||
export _SILENT_FAILED_LOG="$logfile"
|
export _SILENT_FAILED_LOG="$logfile"
|
||||||
|
|
||||||
# ── Structured error capture (.errinfo) for telemetry ──
|
|
||||||
# Extract exactly THIS command's output (from the recorded byte offset),
|
|
||||||
# strip ANSI/progress noise, keep the last 60 lines. The host builds the
|
|
||||||
# telemetry error trace from this file (pulled from the container on
|
|
||||||
# failure). Self-contained - containers don't source api.func.
|
|
||||||
{
|
|
||||||
local flat_cmd
|
|
||||||
flat_cmd=$(printf '%s' "$cmd" | tr '\n' ' ' | head -c 300)
|
|
||||||
echo "EXIT_CODE=${rc}"
|
|
||||||
echo "LINE=${caller_line}"
|
|
||||||
echo "COMMAND=${flat_cmd}"
|
|
||||||
echo "--- OUTPUT ---"
|
|
||||||
if [[ -s "$logfile" ]]; then
|
|
||||||
local segment
|
|
||||||
segment=$(tail -c +"$((start_bytes + 1))" "$logfile" 2>/dev/null |
|
|
||||||
sed 's/\r$//' |
|
|
||||||
sed 's/\x1b\[[0-9;]*[a-zA-Z]//g' |
|
|
||||||
grep -avE '^(Get:|Hit:|Ign:|Fetched |Reading package lists|Reading state information|Building dependency tree|Selecting previously|Preparing to unpack|Unpacking |Processing triggers for|\(Reading database|[0-9]+%[[:space:]]*\[)' |
|
|
||||||
grep -avE '^[[:space:]]*$' |
|
|
||||||
tail -n 60)
|
|
||||||
# If the noise filter swallowed everything, fall back to the raw tail
|
|
||||||
if [[ -z "$segment" ]]; then
|
|
||||||
segment=$(tail -c +"$((start_bytes + 1))" "$logfile" 2>/dev/null |
|
|
||||||
sed 's/\r$//' | sed 's/\x1b\[[0-9;]*[a-zA-Z]//g' | tail -n 60)
|
|
||||||
fi
|
|
||||||
printf '%s' "$segment" | head -c 10240
|
|
||||||
fi
|
|
||||||
} >"${logfile}.errinfo" 2>/dev/null || true
|
|
||||||
|
|
||||||
return "$rc"
|
return "$rc"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Clear stale flags on success (prevents false positives if a previous
|
# Clear stale flags on success (prevents false positives if a previous
|
||||||
# $STD cmd || true failed and a later non-silent command triggers error_handler)
|
# $STD cmd || true failed and a later non-silent command triggers error_handler)
|
||||||
unset _SILENT_FAILED_RC _SILENT_FAILED_CMD _SILENT_FAILED_LINE _SILENT_FAILED_LOG 2>/dev/null || true
|
unset _SILENT_FAILED_RC _SILENT_FAILED_CMD _SILENT_FAILED_LINE _SILENT_FAILED_LOG 2>/dev/null || true
|
||||||
# Also drop a stale .errinfo from a previously tolerated failure ($STD cmd || true)
|
|
||||||
rm -f "${logfile}.errinfo" 2>/dev/null || true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|||||||
+220
-180
@@ -7,17 +7,12 @@
|
|||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Provides error handling and signal management for all scripts.
|
# Provides comprehensive error handling and signal management for all scripts.
|
||||||
#
|
# Includes:
|
||||||
# TELEMETRY CONTRACT:
|
# - Exit code explanations (shell, package managers, databases, custom codes)
|
||||||
# - HOST context: this file reports terminal statuses via post_update_to_api
|
# - Error handler with detailed logging
|
||||||
# (full metadata + focused error trace).
|
# - Signal handlers (EXIT, INT, TERM)
|
||||||
# - CONTAINER context: this file NEVER talks to the telemetry API. It writes
|
# - Initialization function for trap setup
|
||||||
# two local artifacts that the host picks up after lxc-attach returns:
|
|
||||||
# /root/.install-<SESSION_ID>.failed → exit code (flag file)
|
|
||||||
# /root/.install-<SESSION_ID>.log.errinfo → structured error capture
|
|
||||||
# This guarantees the server only ever sees ONE terminal event per
|
|
||||||
# execution - the host's complete one.
|
|
||||||
#
|
#
|
||||||
# Usage:
|
# Usage:
|
||||||
# source <(curl -fsSL .../error_handler.func)
|
# source <(curl -fsSL .../error_handler.func)
|
||||||
@@ -26,14 +21,15 @@
|
|||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# SECTION 1: EXIT CODE EXPLANATIONS (fallback)
|
# SECTION 1: EXIT CODE EXPLANATIONS
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# explain_exit_code()
|
# explain_exit_code()
|
||||||
#
|
#
|
||||||
# - Canonical version lives in api.func (sourced before this file on the host)
|
# - Canonical version is defined in api.func (sourced before this file)
|
||||||
# - This fallback covers the container context where api.func is not sourced
|
# - This section only provides a fallback if api.func was not loaded
|
||||||
|
# - See api.func SECTION 1 for the authoritative exit code mappings
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
if ! declare -f explain_exit_code &>/dev/null; then
|
if ! declare -f explain_exit_code &>/dev/null; then
|
||||||
explain_exit_code() {
|
explain_exit_code() {
|
||||||
@@ -98,6 +94,8 @@ if ! declare -f explain_exit_code &>/dev/null; then
|
|||||||
100) echo "APT: Package manager error (broken packages / dependency problems)" ;;
|
100) echo "APT: Package manager error (broken packages / dependency problems)" ;;
|
||||||
101) echo "APT: Configuration error (bad sources.list, malformed config)" ;;
|
101) echo "APT: Configuration error (bad sources.list, malformed config)" ;;
|
||||||
102) echo "APT: Lock held by another process (dpkg/apt still running)" ;;
|
102) echo "APT: Lock held by another process (dpkg/apt still running)" ;;
|
||||||
|
|
||||||
|
# --- Script Validation & Setup (103-123) ---
|
||||||
103) echo "Validation: Shell is not Bash" ;;
|
103) echo "Validation: Shell is not Bash" ;;
|
||||||
104) echo "Validation: Not running as root (or invoked via sudo)" ;;
|
104) echo "Validation: Not running as root (or invoked via sudo)" ;;
|
||||||
105) echo "Validation: Proxmox VE version not supported" ;;
|
105) echo "Validation: Proxmox VE version not supported" ;;
|
||||||
@@ -179,8 +177,9 @@ if ! declare -f explain_exit_code &>/dev/null; then
|
|||||||
223) echo "Proxmox: Template not available after download" ;;
|
223) echo "Proxmox: Template not available after download" ;;
|
||||||
224) echo "Proxmox: PBS storage is for backups only" ;;
|
224) echo "Proxmox: PBS storage is for backups only" ;;
|
||||||
225) echo "Proxmox: No template available for OS/Version" ;;
|
225) echo "Proxmox: No template available for OS/Version" ;;
|
||||||
226) echo "Proxmox: VM disk import or post-creation setup failed" ;;
|
|
||||||
231) echo "Proxmox: LXC stack upgrade failed" ;;
|
231) echo "Proxmox: LXC stack upgrade failed" ;;
|
||||||
|
|
||||||
|
# --- Tools & Addon Scripts (232-238) ---
|
||||||
232) echo "Tools: Wrong execution environment (run on PVE host, not inside LXC)" ;;
|
232) echo "Tools: Wrong execution environment (run on PVE host, not inside LXC)" ;;
|
||||||
233) echo "Tools: Application not installed (update prerequisite missing)" ;;
|
233) echo "Tools: Application not installed (update prerequisite missing)" ;;
|
||||||
234) echo "Tools: No LXC containers found or available" ;;
|
234) echo "Tools: No LXC containers found or available" ;;
|
||||||
@@ -188,6 +187,7 @@ if ! declare -f explain_exit_code &>/dev/null; then
|
|||||||
236) echo "Tools: Required hardware not detected" ;;
|
236) echo "Tools: Required hardware not detected" ;;
|
||||||
237) echo "Tools: Dependency package installation failed" ;;
|
237) echo "Tools: Dependency package installation failed" ;;
|
||||||
238) echo "Tools: OS or distribution not supported for this addon" ;;
|
238) echo "Tools: OS or distribution not supported for this addon" ;;
|
||||||
|
|
||||||
239) echo "npm/Node.js: Unexpected runtime error or dependency failure" ;;
|
239) echo "npm/Node.js: Unexpected runtime error or dependency failure" ;;
|
||||||
243) echo "Node.js: Out of memory (JavaScript heap out of memory)" ;;
|
243) echo "Node.js: Out of memory (JavaScript heap out of memory)" ;;
|
||||||
245) echo "Node.js: Invalid command-line option" ;;
|
245) echo "Node.js: Invalid command-line option" ;;
|
||||||
@@ -195,11 +195,14 @@ if ! declare -f explain_exit_code &>/dev/null; then
|
|||||||
247) echo "Node.js: Fatal internal error" ;;
|
247) echo "Node.js: Fatal internal error" ;;
|
||||||
248) echo "Node.js: Invalid C++ addon / N-API failure" ;;
|
248) echo "Node.js: Invalid C++ addon / N-API failure" ;;
|
||||||
249) echo "npm/pnpm/yarn: Unknown fatal error" ;;
|
249) echo "npm/pnpm/yarn: Unknown fatal error" ;;
|
||||||
|
|
||||||
|
# --- Application Install/Update Errors (250-254) ---
|
||||||
250) echo "App: Download failed or version not determined" ;;
|
250) echo "App: Download failed or version not determined" ;;
|
||||||
251) echo "App: File extraction failed (corrupt or incomplete archive)" ;;
|
251) echo "App: File extraction failed (corrupt or incomplete archive)" ;;
|
||||||
252) echo "App: Required file or resource not found" ;;
|
252) echo "App: Required file or resource not found" ;;
|
||||||
253) echo "App: Data migration required — update aborted" ;;
|
253) echo "App: Data migration required — update aborted" ;;
|
||||||
254) echo "App: User declined prompt or input timed out" ;;
|
254) echo "App: User declined prompt or input timed out" ;;
|
||||||
|
|
||||||
255) echo "DPKG: Fatal internal error" ;;
|
255) echo "DPKG: Fatal internal error" ;;
|
||||||
*) echo "Unknown error" ;;
|
*) echo "Unknown error" ;;
|
||||||
esac
|
esac
|
||||||
@@ -207,98 +210,24 @@ if ! declare -f explain_exit_code &>/dev/null; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# SECTION 2: CONTEXT DETECTION & CONTAINER ARTIFACTS
|
# SECTION 2: ERROR HANDLERS
|
||||||
# ==============================================================================
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
|
||||||
# _is_container_context()
|
|
||||||
#
|
|
||||||
# - Returns 0 (true) when running INSIDE the LXC container being installed
|
|
||||||
# - TELEMETRY_CONTEXT can override the heuristic ("host" / "container");
|
|
||||||
# install.func sets TELEMETRY_CONTEXT=container during bootstrap
|
|
||||||
# ------------------------------------------------------------------------------
|
|
||||||
_is_container_context() {
|
|
||||||
case "${TELEMETRY_CONTEXT:-}" in
|
|
||||||
container) return 0 ;;
|
|
||||||
host) return 1 ;;
|
|
||||||
esac
|
|
||||||
# Proxmox/Incus tooling exists only on the host
|
|
||||||
command -v pveversion &>/dev/null && return 1
|
|
||||||
command -v pct &>/dev/null && return 1
|
|
||||||
command -v incus &>/dev/null && return 1
|
|
||||||
# systemd-detect-virt reports lxc inside containers
|
|
||||||
if command -v systemd-detect-virt &>/dev/null; then
|
|
||||||
case "$(systemd-detect-virt -c 2>/dev/null)" in
|
|
||||||
lxc | lxc-libvirt | openvz) return 0 ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
# PCT_OSTYPE is exported into the install environment by the host
|
|
||||||
[[ -n "${PCT_OSTYPE:-}" ]] && return 0
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
|
||||||
# _container_write_failure()
|
|
||||||
#
|
|
||||||
# - Writes the failure artifacts inside the container for the host to pick up:
|
|
||||||
# * flag file with the exit code
|
|
||||||
# * .errinfo capture (if silent() has not already written a better one)
|
|
||||||
# * copy of the install log
|
|
||||||
# - This REPLACES any direct telemetry send from the container
|
|
||||||
# - Arguments: $1 = exit_code, $2 = command (optional), $3 = line (optional)
|
|
||||||
# ------------------------------------------------------------------------------
|
|
||||||
_container_write_failure() {
|
|
||||||
local exit_code="${1:-1}"
|
|
||||||
local command="${2:-}"
|
|
||||||
local line="${3:-}"
|
|
||||||
local sid="${SESSION_ID:-error}"
|
|
||||||
|
|
||||||
# Flag file with exit code (host reads this after lxc-attach returns)
|
|
||||||
echo "$exit_code" >"/root/.install-${sid}.failed" 2>/dev/null || true
|
|
||||||
|
|
||||||
# Keep the install log where the host expects it
|
|
||||||
if [[ -n "${INSTALL_LOG:-}" && -f "${INSTALL_LOG}" && "${INSTALL_LOG}" != "/root/.install-${sid}.log" ]]; then
|
|
||||||
cp "${INSTALL_LOG}" "/root/.install-${sid}.log" 2>/dev/null || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Structured error capture (skip if silent() already wrote the exact
|
|
||||||
# output segment of the failing command - that one is always better).
|
|
||||||
# Self-contained: api.func is NOT sourced inside containers.
|
|
||||||
local errinfo="${INSTALL_LOG:-/root/.install-${sid}.log}.errinfo"
|
|
||||||
if [[ ! -s "$errinfo" ]]; then
|
|
||||||
local flat_cmd
|
|
||||||
flat_cmd=$(printf '%s' "${command:-unknown}" | tr '\n' ' ' | head -c 300)
|
|
||||||
{
|
|
||||||
echo "EXIT_CODE=${exit_code}"
|
|
||||||
echo "LINE=${line:-0}"
|
|
||||||
echo "COMMAND=${flat_cmd}"
|
|
||||||
echo "--- OUTPUT ---"
|
|
||||||
if [[ -n "${INSTALL_LOG:-}" && -s "${INSTALL_LOG}" ]]; then
|
|
||||||
tail -n 80 "${INSTALL_LOG}" 2>/dev/null |
|
|
||||||
sed 's/\r$//' |
|
|
||||||
sed 's/\x1b\[[0-9;]*[a-zA-Z]//g' |
|
|
||||||
grep -avE '^(Get:|Hit:|Ign:|Fetched |Reading package lists|Reading state information|Building dependency tree|Selecting previously|Preparing to unpack|Unpacking |Processing triggers for|\(Reading database|[0-9]+%[[:space:]]*\[)' |
|
|
||||||
grep -avE '^[[:space:]]*$' |
|
|
||||||
tail -n 60 | head -c 10240
|
|
||||||
fi
|
|
||||||
} >"$errinfo" 2>/dev/null || true
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# ==============================================================================
|
|
||||||
# SECTION 3: ERROR HANDLER
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# error_handler()
|
# error_handler()
|
||||||
#
|
#
|
||||||
# - Main error handler triggered by ERR trap
|
# - Main error handler triggered by ERR trap
|
||||||
# - Displays error message with line number, exit code, explanation, command
|
# - Arguments: exit_code, command, line_number
|
||||||
# - Shows last 20 lines of the active log
|
# - Behavior:
|
||||||
# - Emits actionable hints for common failure patterns (OOM, APT, network...)
|
# * Returns silently if exit_code is 0 (success)
|
||||||
# - HOST: reports "failed" to telemetry (full payload via api.func)
|
# * Sources explain_exit_code() for detailed error description
|
||||||
# - CONTAINER: writes failure artifacts, sends nothing
|
# * Displays error message with:
|
||||||
# - Exits with original exit code
|
# - Line number where error occurred
|
||||||
|
# - Exit code with explanation
|
||||||
|
# - Command that failed
|
||||||
|
# * Shows last 20 lines of SILENT_LOGFILE if available
|
||||||
|
# * Copies log to container /root for later inspection
|
||||||
|
# * Exits with original exit code
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
error_handler() {
|
error_handler() {
|
||||||
local exit_code=${1:-$?}
|
local exit_code=${1:-$?}
|
||||||
@@ -308,10 +237,12 @@ error_handler() {
|
|||||||
command="${command//\$STD/}"
|
command="${command//\$STD/}"
|
||||||
|
|
||||||
# If error originated from silent(), use its captured metadata
|
# If error originated from silent(), use its captured metadata
|
||||||
|
# This provides the actual command and line number instead of "silent ..."
|
||||||
if [[ -n "${_SILENT_FAILED_RC:-}" ]]; then
|
if [[ -n "${_SILENT_FAILED_RC:-}" ]]; then
|
||||||
exit_code="$_SILENT_FAILED_RC"
|
exit_code="$_SILENT_FAILED_RC"
|
||||||
command="$_SILENT_FAILED_CMD"
|
command="$_SILENT_FAILED_CMD"
|
||||||
line_number="$_SILENT_FAILED_LINE"
|
line_number="$_SILENT_FAILED_LINE"
|
||||||
|
# Clear flags to prevent stale data on subsequent errors
|
||||||
unset _SILENT_FAILED_RC _SILENT_FAILED_CMD _SILENT_FAILED_LINE
|
unset _SILENT_FAILED_RC _SILENT_FAILED_CMD _SILENT_FAILED_LINE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -319,12 +250,8 @@ error_handler() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Export the failure location so telemetry can include the "where"
|
# Stop spinner and restore cursor FIRST — before any output
|
||||||
FAILED_COMMAND="$command"
|
# This prevents spinner text overlapping with error messages
|
||||||
FAILED_LINE="$line_number"
|
|
||||||
export FAILED_COMMAND FAILED_LINE
|
|
||||||
|
|
||||||
# Stop spinner and restore cursor FIRST - before any output
|
|
||||||
if declare -f stop_spinner >/dev/null 2>&1; then
|
if declare -f stop_spinner >/dev/null 2>&1; then
|
||||||
stop_spinner 2>/dev/null || true
|
stop_spinner 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
@@ -332,18 +259,18 @@ error_handler() {
|
|||||||
|
|
||||||
local explanation
|
local explanation
|
||||||
explanation="$(explain_exit_code "$exit_code")"
|
explanation="$(explain_exit_code "$exit_code")"
|
||||||
if [[ "$explanation" == curl:* && ! "$command" =~ (^|[[:space:]])([^[:space:]]*/)?curl([[:space:]]|$) ]]; then
|
|
||||||
explanation="Command failed with exit status ${exit_code}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ── Telemetry / failure artifacts ──
|
# ALWAYS report failure to API immediately - don't wait for container checks
|
||||||
if _is_container_context; then
|
# This ensures we capture failures that occur before/after container exists
|
||||||
_container_write_failure "$exit_code" "$command" "$line_number"
|
if declare -f post_update_to_api &>/dev/null; then
|
||||||
elif declare -f post_update_to_api &>/dev/null; then
|
|
||||||
post_update_to_api "failed" "$exit_code" 2>/dev/null || true
|
post_update_to_api "failed" "$exit_code" 2>/dev/null || true
|
||||||
|
else
|
||||||
|
# Container context: post_update_to_api not available (api.func not sourced)
|
||||||
|
# Send status directly via curl so container failures are never lost
|
||||||
|
_send_abort_telemetry "$exit_code" 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ── Display ──
|
# Use msg_error if available, fallback to echo
|
||||||
if declare -f msg_error >/dev/null 2>&1; then
|
if declare -f msg_error >/dev/null 2>&1; then
|
||||||
msg_error "in line ${line_number}: exit code ${exit_code} (${explanation}): while executing command ${command}"
|
msg_error "in line ${line_number}: exit code ${exit_code} (${explanation}): while executing command ${command}"
|
||||||
else
|
else
|
||||||
@@ -361,7 +288,8 @@ error_handler() {
|
|||||||
} >>"$DEBUG_LOGFILE"
|
} >>"$DEBUG_LOGFILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get active log file (prefer silent()'s logfile when available)
|
# Get active log file (BUILD_LOG or INSTALL_LOG)
|
||||||
|
# Prefer silent()'s logfile when available (contains the actual command output)
|
||||||
local active_log=""
|
local active_log=""
|
||||||
if [[ -n "${_SILENT_FAILED_LOG:-}" && -s "${_SILENT_FAILED_LOG}" ]]; then
|
if [[ -n "${_SILENT_FAILED_LOG:-}" && -s "${_SILENT_FAILED_LOG}" ]]; then
|
||||||
active_log="$_SILENT_FAILED_LOG"
|
active_log="$_SILENT_FAILED_LOG"
|
||||||
@@ -372,17 +300,21 @@ error_handler() {
|
|||||||
active_log="$SILENT_LOGFILE"
|
active_log="$SILENT_LOGFILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# If active_log points to a container-internal path that doesn't exist on host,
|
||||||
|
# fall back to BUILD_LOG (host-side log)
|
||||||
if [[ -n "$active_log" && ! -s "$active_log" && -n "${BUILD_LOG:-}" && -s "${BUILD_LOG}" ]]; then
|
if [[ -n "$active_log" && ! -s "$active_log" && -n "${BUILD_LOG:-}" && -s "${BUILD_LOG}" ]]; then
|
||||||
active_log="$BUILD_LOG"
|
active_log="$BUILD_LOG"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Show last log lines if available
|
||||||
if [[ -n "$active_log" && -s "$active_log" ]]; then
|
if [[ -n "$active_log" && -s "$active_log" ]]; then
|
||||||
echo -e "\n${TAB}--- Last 20 lines of log ---"
|
echo -e "\n${TAB}--- Last 20 lines of log ---"
|
||||||
tail -n 20 "$active_log"
|
tail -n 20 "$active_log"
|
||||||
echo -e "${TAB}-----------------------------------\n"
|
echo -e "${TAB}-----------------------------------\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ── Node.js heap OOM detection with actionable guidance ──
|
# Detect probable Node.js heap OOM and print actionable guidance.
|
||||||
|
# This avoids generic SIGABRT/SIGKILL confusion for frontend build failures.
|
||||||
local node_oom_detected="false"
|
local node_oom_detected="false"
|
||||||
local node_build_context="false"
|
local node_build_context="false"
|
||||||
if [[ "$command" =~ (npm|pnpm|yarn|node|vite|turbo) ]]; then
|
if [[ "$command" =~ (npm|pnpm|yarn|node|vite|turbo) ]]; then
|
||||||
@@ -399,6 +331,7 @@ error_handler() {
|
|||||||
if [[ "$node_oom_detected" == "true" ]] || { [[ "$node_build_context" == "true" ]] && [[ "$exit_code" =~ ^(134|137)$ ]]; }; then
|
if [[ "$node_oom_detected" == "true" ]] || { [[ "$node_build_context" == "true" ]] && [[ "$exit_code" =~ ^(134|137)$ ]]; }; then
|
||||||
local heap_hint_mb=""
|
local heap_hint_mb=""
|
||||||
|
|
||||||
|
# If explicitly configured, prefer the current value for troubleshooting output.
|
||||||
if [[ -n "${NODE_OPTIONS:-}" ]] && [[ "${NODE_OPTIONS}" =~ max-old-space-size=([0-9]+) ]]; then
|
if [[ -n "${NODE_OPTIONS:-}" ]] && [[ "${NODE_OPTIONS}" =~ max-old-space-size=([0-9]+) ]]; then
|
||||||
heap_hint_mb="${BASH_REMATCH[1]}"
|
heap_hint_mb="${BASH_REMATCH[1]}"
|
||||||
elif [[ -n "${var_ram:-}" ]] && [[ "${var_ram}" =~ ^[0-9]+$ ]]; then
|
elif [[ -n "${var_ram:-}" ]] && [[ "${var_ram}" =~ ^[0-9]+$ ]]; then
|
||||||
@@ -425,13 +358,14 @@ error_handler() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ── Log-pattern analysis: actionable hints for common failure causes ──
|
# ── Log-pattern analysis: detect common failure causes and emit actionable hints ──
|
||||||
if [[ -n "$active_log" && -s "$active_log" ]]; then
|
if [[ -n "$active_log" && -s "$active_log" ]]; then
|
||||||
local _log_tail
|
local _log_tail
|
||||||
_log_tail=$(tail -n 60 "$active_log" 2>/dev/null || true)
|
_log_tail=$(tail -n 60 "$active_log" 2>/dev/null || true)
|
||||||
|
|
||||||
# 1. APT/dpkg dependency conflict
|
# 1. APT/dpkg dependency conflict
|
||||||
if echo "$_log_tail" | grep -qE "Depends:|depends on.*but.*not installed|broken packages|unmet dep|dependency problems"; then
|
if echo "$_log_tail" | grep -qE "Depends:|depends on.*but.*not installed|broken packages|unmet dep|dependency problems"; then
|
||||||
|
# Check for PostgreSQL-specific version mismatch (most actionable)
|
||||||
local _pg_conflict
|
local _pg_conflict
|
||||||
_pg_conflict=$(echo "$_log_tail" | grep -oE 'postgresql-[0-9]+ but.*installed' | head -1 || true)
|
_pg_conflict=$(echo "$_log_tail" | grep -oE 'postgresql-[0-9]+ but.*installed' | head -1 || true)
|
||||||
if [[ -n "$_pg_conflict" ]]; then
|
if [[ -n "$_pg_conflict" ]]; then
|
||||||
@@ -452,7 +386,7 @@ error_handler() {
|
|||||||
msg_warn "Hint: A repository GPG key may be missing, expired, or the keyring file is not yet present (/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc etc.)."
|
msg_warn "Hint: A repository GPG key may be missing, expired, or the keyring file is not yet present (/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc etc.)."
|
||||||
msg_warn "Hint: Install the 'postgresql-common' package first, or re-add the repository with its correct signing key."
|
msg_warn "Hint: Install the 'postgresql-common' package first, or re-add the repository with its correct signing key."
|
||||||
fi
|
fi
|
||||||
# 3. Network / DNS failure
|
# 3. Network / DNS failure during apt-get or curl
|
||||||
elif echo "$_log_tail" | grep -qE "Could not resolve|Failed to fetch|Unable to connect|Name or service not known|Network is unreachable|curl.*resolve"; then
|
elif echo "$_log_tail" | grep -qE "Could not resolve|Failed to fetch|Unable to connect|Name or service not known|Network is unreachable|curl.*resolve"; then
|
||||||
if declare -f msg_warn >/dev/null 2>&1; then
|
if declare -f msg_warn >/dev/null 2>&1; then
|
||||||
msg_warn "Network or DNS failure detected."
|
msg_warn "Network or DNS failure detected."
|
||||||
@@ -473,12 +407,17 @@ error_handler() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ── Context-specific cleanup ──
|
# Detect context: Container (INSTALL_LOG set + inside container /root) vs Host
|
||||||
if _is_container_context; then
|
if [[ -n "${INSTALL_LOG:-}" && -f "${INSTALL_LOG:-}" && -d /root ]]; then
|
||||||
# Container: artifacts already written above; nothing more to do
|
# CONTAINER CONTEXT: Copy log and create flag file for host
|
||||||
:
|
local container_log="/root/.install-${SESSION_ID:-error}.log"
|
||||||
|
cp "${INSTALL_LOG}" "$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
|
||||||
|
# Log path is shown by host as combined log - no need to show container path
|
||||||
else
|
else
|
||||||
# HOST: show log path and offer container cleanup
|
# HOST CONTEXT: Show local log path and offer container cleanup
|
||||||
if [[ -n "$active_log" && -s "$active_log" ]]; then
|
if [[ -n "$active_log" && -s "$active_log" ]]; then
|
||||||
if declare -f msg_custom >/dev/null 2>&1; then
|
if declare -f msg_custom >/dev/null 2>&1; then
|
||||||
msg_custom "📋" "${YW}" "Full log: ${active_log}"
|
msg_custom "📋" "${YW}" "Full log: ${active_log}"
|
||||||
@@ -496,6 +435,7 @@ error_handler() {
|
|||||||
echo -en "${YW}Remove broken container ${CTID}? (Y/n) [auto-remove in 60s]: ${CL}"
|
echo -en "${YW}Remove broken container ${CTID}? (Y/n) [auto-remove in 60s]: ${CL}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Read user response
|
||||||
local response=""
|
local response=""
|
||||||
if read -t 60 -r response; then
|
if read -t 60 -r response; then
|
||||||
if [[ -z "$response" || "$response" =~ ^[Yy]$ ]]; then
|
if [[ -z "$response" || "$response" =~ ^[Yy]$ ]]; then
|
||||||
@@ -536,6 +476,12 @@ error_handler() {
|
|||||||
echo -e "${GN}✔${CL} Container ${CTID} removed"
|
echo -e "${GN}✔${CL} Container ${CTID} removed"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Force one final status update attempt after cleanup
|
||||||
|
# This ensures status is updated even if the first attempt failed (e.g., HTTP 400)
|
||||||
|
if declare -f post_update_to_api &>/dev/null; then
|
||||||
|
post_update_to_api "failed" "$exit_code" "force"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -543,33 +489,106 @@ error_handler() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# SECTION 4: TELEMETRY & CLEANUP HELPERS FOR SIGNAL HANDLERS
|
# SECTION 3: TELEMETRY & CLEANUP HELPERS FOR SIGNAL HANDLERS
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# _send_abort_telemetry() (compatibility name)
|
# _send_abort_telemetry()
|
||||||
#
|
#
|
||||||
# - HOST: reports via post_update_to_api (signals map to "aborted" there)
|
# - Sends failure/abort status to telemetry API
|
||||||
# - CONTAINER: writes failure artifacts instead of sending anything
|
# - Works in BOTH host context (post_update_to_api available) and
|
||||||
|
# container context (only curl available, api.func not sourced)
|
||||||
|
# - Container context is critical: without this, container-side failures
|
||||||
|
# and signal exits are never reported, leaving records stuck in
|
||||||
|
# "installing" or "configuring" forever
|
||||||
# - Arguments: $1 = exit_code
|
# - Arguments: $1 = exit_code
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
_send_abort_telemetry() {
|
_send_abort_telemetry() {
|
||||||
local exit_code="${1:-1}"
|
local exit_code="${1:-1}"
|
||||||
if _is_container_context; then
|
# Try full API function first (host context - api.func sourced)
|
||||||
_container_write_failure "$exit_code"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
if declare -f post_update_to_api &>/dev/null; then
|
if declare -f post_update_to_api &>/dev/null; then
|
||||||
post_update_to_api "failed" "$exit_code" 2>/dev/null || true
|
post_update_to_api "failed" "$exit_code" 2>/dev/null || true
|
||||||
|
return
|
||||||
fi
|
fi
|
||||||
|
# Fallback: direct curl (container context - api.func NOT sourced)
|
||||||
|
# This is the ONLY way containers can report failures to telemetry
|
||||||
|
command -v curl &>/dev/null || return 0
|
||||||
|
[[ "${DIAGNOSTICS:-no}" == "no" ]] && return 0
|
||||||
|
[[ -z "${RANDOM_UUID:-}" ]] && return 0
|
||||||
|
|
||||||
|
# Collect last 200 log lines for error diagnosis (best-effort)
|
||||||
|
# Container context has no get_full_log(), so we gather as much as possible
|
||||||
|
local error_text=""
|
||||||
|
local logfile=""
|
||||||
|
if [[ -n "${INSTALL_LOG:-}" && -s "${INSTALL_LOG}" ]]; then
|
||||||
|
logfile="${INSTALL_LOG}"
|
||||||
|
elif [[ -n "${SILENT_LOGFILE:-}" && -s "${SILENT_LOGFILE}" ]]; then
|
||||||
|
logfile="${SILENT_LOGFILE}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "$logfile" ]]; then
|
||||||
|
error_text=$(tail -n 200 "$logfile" 2>/dev/null | sed 's/\x1b\[[0-9;]*[a-zA-Z]//g; s/\\/\\\\/g; s/"/\\"/g; s/\r//g' | tr '\n' '|' | sed 's/|$//' | head -c 16384 | tr -d '\000-\010\013\014\016-\037\177') || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Prepend exit code explanation header (like build_error_string does on host)
|
||||||
|
local explanation=""
|
||||||
|
if declare -f explain_exit_code &>/dev/null; then
|
||||||
|
explanation=$(explain_exit_code "$exit_code" 2>/dev/null) || true
|
||||||
|
fi
|
||||||
|
if [[ -n "$explanation" && -n "$error_text" ]]; then
|
||||||
|
error_text="exit_code=${exit_code} | ${explanation}|---|${error_text}"
|
||||||
|
elif [[ -n "$explanation" && -z "$error_text" ]]; then
|
||||||
|
error_text="exit_code=${exit_code} | ${explanation}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Calculate duration if start time is available
|
||||||
|
local duration=""
|
||||||
|
if [[ -n "${DIAGNOSTICS_START_TIME:-}" ]]; then
|
||||||
|
duration=$(($(date +%s) - DIAGNOSTICS_START_TIME))
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Categorize error if function is available (may not be in minimal container context)
|
||||||
|
local error_category=""
|
||||||
|
if declare -f categorize_error &>/dev/null; then
|
||||||
|
error_category=$(categorize_error "$exit_code" 2>/dev/null) || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Build JSON payload with error context
|
||||||
|
local payload
|
||||||
|
payload="{\"random_id\":\"${RANDOM_UUID}\",\"execution_id\":\"${EXECUTION_ID:-${RANDOM_UUID}}\",\"type\":\"${TELEMETRY_TYPE:-lxc}\",\"nsapp\":\"${NSAPP:-${app:-unknown}}\",\"status\":\"failed\",\"exit_code\":${exit_code}"
|
||||||
|
[[ -n "$error_text" ]] && payload="${payload},\"error\":\"${error_text}\""
|
||||||
|
[[ -n "$error_category" ]] && payload="${payload},\"error_category\":\"${error_category}\""
|
||||||
|
[[ -n "$duration" ]] && payload="${payload},\"duration\":${duration}"
|
||||||
|
payload="${payload}}"
|
||||||
|
|
||||||
|
local api_url="${TELEMETRY_URL:-https://telemetry.community-scripts.org/telemetry}"
|
||||||
|
|
||||||
|
# 2 attempts (retry once on failure) — original had no retry
|
||||||
|
local attempt
|
||||||
|
for attempt in 1 2; do
|
||||||
|
if curl -fsS -m 5 -X POST "$api_url" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "$payload" &>/dev/null; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
[[ $attempt -eq 1 ]] && sleep 1
|
||||||
|
done
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# _stop_container_if_installing()
|
# _stop_container_if_installing()
|
||||||
#
|
#
|
||||||
# - Stops the LXC container if we're in the install phase (host only)
|
# - Stops the LXC container if we're in the install phase
|
||||||
# - Prevents orphaned container processes when the host exits due to a signal
|
# - Prevents orphaned container processes when the host exits due to a signal
|
||||||
|
# (SSH disconnect, Ctrl+C, SIGTERM) — without this, the container keeps
|
||||||
|
# running and may send "configuring" status AFTER the host already sent
|
||||||
|
# "failed", leaving records permanently stuck in "configuring"
|
||||||
|
# - Only acts when:
|
||||||
|
# * CONTAINER_INSTALLING flag is set (during lxc-attach in build_container)
|
||||||
|
# * CTID is set (container was created)
|
||||||
|
# * pct command is available (we're on the Proxmox host, not inside a container)
|
||||||
|
# - Does NOT destroy the container — just stops it for potential debugging
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
_stop_container_if_installing() {
|
_stop_container_if_installing() {
|
||||||
[[ "${CONTAINER_INSTALLING:-}" == "true" ]] || return 0
|
[[ "${CONTAINER_INSTALLING:-}" == "true" ]] || return 0
|
||||||
@@ -579,47 +598,51 @@ _stop_container_if_installing() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# SECTION 5: SIGNAL HANDLERS
|
# SECTION 4: SIGNAL HANDLERS
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# on_exit()
|
# on_exit()
|
||||||
#
|
#
|
||||||
# - EXIT trap handler — runs on EVERY script termination
|
# - EXIT trap handler — runs on EVERY script termination
|
||||||
# - CONTAINER: ensures failure artifacts exist on non-zero exit (this also
|
# - Catches orphaned "installing"/"configuring" records:
|
||||||
# covers silent()'s direct `exit $rc`, which bypasses the ERR trap)
|
# * If post_to_api sent "installing" but post_update_to_api never ran
|
||||||
# - HOST: catches executions that never sent a final status:
|
# * Reports final status to prevent records stuck forever
|
||||||
# * non-zero exit → "failed" (signal codes map to "aborted")
|
# - Best-effort log collection for failed installs
|
||||||
# * zero exit with an "installing" record but no final → "aborted"
|
# - Stops orphaned container processes on failure
|
||||||
# (e.g. user cancelled a whiptail dialog, script exited cleanly)
|
# - Cleans up lock files
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
on_exit() {
|
on_exit() {
|
||||||
local exit_code=$?
|
local exit_code=$?
|
||||||
|
|
||||||
if _is_container_context; then
|
# Report orphaned telemetry records
|
||||||
if [[ $exit_code -ne 0 ]]; then
|
# Two scenarios handled:
|
||||||
_container_write_failure "$exit_code" "${FAILED_COMMAND:-}" "${FAILED_LINE:-}"
|
# 1. POST_TO_API_DONE=true but POST_UPDATE_DONE=false: Record was created but
|
||||||
fi
|
# never got a final status update → send abort/done now.
|
||||||
else
|
# 2. POST_TO_API_DONE=false but DIAGNOSTICS=yes: Initial post failed (server
|
||||||
if [[ "${POST_UPDATE_DONE:-}" != "true" ]] && declare -f post_update_to_api >/dev/null 2>&1; then
|
# unreachable/timeout), but the server has fallback create-on-update logic,
|
||||||
|
# so a status update can still create the record. Worth one last try.
|
||||||
|
if [[ "${POST_UPDATE_DONE:-}" != "true" ]]; then
|
||||||
|
if [[ "${POST_TO_API_DONE:-}" == "true" || "${DIAGNOSTICS:-no}" == "yes" ]]; then
|
||||||
if [[ $exit_code -ne 0 ]]; then
|
if [[ $exit_code -ne 0 ]]; then
|
||||||
post_update_to_api "failed" "$exit_code" 2>/dev/null || true
|
_send_abort_telemetry "$exit_code"
|
||||||
elif [[ "${POST_TO_API_DONE:-}" == "true" ]]; then
|
elif [[ "${INSTALL_COMPLETE:-}" == "true" ]] && declare -f post_update_to_api >/dev/null 2>&1; then
|
||||||
# Clean exit but no success was ever reported: the user backed out
|
# Only report success if the install was explicitly marked complete.
|
||||||
# somewhere. Report as aborted so the record doesn't stay "installing".
|
# Without this guard, early bailouts (e.g. user cancelled) with exit 0
|
||||||
post_update_to_api "aborted" "0" 2>/dev/null || true
|
# would be falsely reported as successful installations.
|
||||||
|
post_update_to_api "done" "0" 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Best-effort log collection on failure
|
# Best-effort log collection on failure (non-critical, telemetry already sent)
|
||||||
if [[ $exit_code -ne 0 ]] && declare -f ensure_log_on_host >/dev/null 2>&1; then
|
if [[ $exit_code -ne 0 ]] && declare -f ensure_log_on_host >/dev/null 2>&1; then
|
||||||
ensure_log_on_host 2>/dev/null || true
|
ensure_log_on_host 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Stop orphaned container if we're in the install phase
|
# Stop orphaned container if we're in the install phase and exiting with error
|
||||||
if [[ $exit_code -ne 0 ]]; then
|
if [[ $exit_code -ne 0 ]]; then
|
||||||
_stop_container_if_installing
|
_stop_container_if_installing
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ -n "${lockfile:-}" && -e "$lockfile" ]] && rm -f "$lockfile"
|
[[ -n "${lockfile:-}" && -e "$lockfile" ]] && rm -f "$lockfile"
|
||||||
@@ -627,19 +650,21 @@ on_exit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# on_interrupt() - SIGINT (Ctrl+C)
|
# on_interrupt()
|
||||||
|
#
|
||||||
|
# - SIGINT (Ctrl+C) trap handler
|
||||||
|
# - Reports status FIRST (time-critical: container may be dying)
|
||||||
|
# - Stops orphaned container to prevent "configuring" ghost records
|
||||||
|
# - Exits with code 130 (128 + SIGINT=2)
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
on_interrupt() {
|
on_interrupt() {
|
||||||
|
# Stop spinner and restore cursor before any output
|
||||||
if declare -f stop_spinner >/dev/null 2>&1; then
|
if declare -f stop_spinner >/dev/null 2>&1; then
|
||||||
stop_spinner 2>/dev/null || true
|
stop_spinner 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
printf "\e[?25h" 2>/dev/null || true
|
printf "\e[?25h" 2>/dev/null || true
|
||||||
|
|
||||||
if _is_container_context; then
|
_send_abort_telemetry "130"
|
||||||
_container_write_failure "130"
|
|
||||||
elif declare -f post_update_to_api &>/dev/null; then
|
|
||||||
post_update_to_api "aborted" "130" 2>/dev/null || true
|
|
||||||
fi
|
|
||||||
_stop_container_if_installing
|
_stop_container_if_installing
|
||||||
if declare -f msg_error >/dev/null 2>&1; then
|
if declare -f msg_error >/dev/null 2>&1; then
|
||||||
msg_error "Interrupted by user (SIGINT)" 2>/dev/null || true
|
msg_error "Interrupted by user (SIGINT)" 2>/dev/null || true
|
||||||
@@ -650,19 +675,21 @@ on_interrupt() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# on_terminate() - SIGTERM
|
# on_terminate()
|
||||||
|
#
|
||||||
|
# - SIGTERM trap handler
|
||||||
|
# - Reports status FIRST (time-critical: process being killed)
|
||||||
|
# - Stops orphaned container to prevent "configuring" ghost records
|
||||||
|
# - Exits with code 143 (128 + SIGTERM=15)
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
on_terminate() {
|
on_terminate() {
|
||||||
|
# Stop spinner and restore cursor before any output
|
||||||
if declare -f stop_spinner >/dev/null 2>&1; then
|
if declare -f stop_spinner >/dev/null 2>&1; then
|
||||||
stop_spinner 2>/dev/null || true
|
stop_spinner 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
printf "\e[?25h" 2>/dev/null || true
|
printf "\e[?25h" 2>/dev/null || true
|
||||||
|
|
||||||
if _is_container_context; then
|
_send_abort_telemetry "143"
|
||||||
_container_write_failure "143"
|
|
||||||
elif declare -f post_update_to_api &>/dev/null; then
|
|
||||||
post_update_to_api "aborted" "143" 2>/dev/null || true
|
|
||||||
fi
|
|
||||||
_stop_container_if_installing
|
_stop_container_if_installing
|
||||||
if declare -f msg_error >/dev/null 2>&1; then
|
if declare -f msg_error >/dev/null 2>&1; then
|
||||||
msg_error "Terminated by signal (SIGTERM)" 2>/dev/null || true
|
msg_error "Terminated by signal (SIGTERM)" 2>/dev/null || true
|
||||||
@@ -673,32 +700,45 @@ on_terminate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# on_hangup() - SIGHUP (SSH disconnect, terminal closed)
|
# on_hangup()
|
||||||
|
#
|
||||||
|
# - SIGHUP trap handler (SSH disconnect, terminal closed)
|
||||||
|
# - CRITICAL: This was previously MISSING from catch_errors(), causing
|
||||||
|
# container processes to become orphans on SSH disconnect — the #1 cause
|
||||||
|
# of records stuck in "installing" and "configuring" states
|
||||||
|
# - Reports status via direct curl (terminal is already closed, no output)
|
||||||
|
# - Stops orphaned container to prevent ghost records
|
||||||
|
# - Exits with code 129 (128 + SIGHUP=1)
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
on_hangup() {
|
on_hangup() {
|
||||||
|
# Stop spinner (no cursor restore needed — terminal is already gone)
|
||||||
if declare -f stop_spinner >/dev/null 2>&1; then
|
if declare -f stop_spinner >/dev/null 2>&1; then
|
||||||
stop_spinner 2>/dev/null || true
|
stop_spinner 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if _is_container_context; then
|
_send_abort_telemetry "129"
|
||||||
_container_write_failure "129"
|
|
||||||
elif declare -f post_update_to_api &>/dev/null; then
|
|
||||||
post_update_to_api "aborted" "129" 2>/dev/null || true
|
|
||||||
fi
|
|
||||||
_stop_container_if_installing
|
_stop_container_if_installing
|
||||||
exit 129
|
exit 129
|
||||||
}
|
}
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# SECTION 6: INITIALIZATION
|
# SECTION 5: INITIALIZATION
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# catch_errors()
|
# catch_errors()
|
||||||
#
|
#
|
||||||
# - Initializes error handling and signal traps
|
# - Initializes error handling and signal traps
|
||||||
# - set -Ee -o pipefail (+ set -u when STRICT_UNSET=1)
|
# - Enables strict error handling:
|
||||||
# - Traps: ERR → error_handler, EXIT → on_exit, INT/TERM/HUP → signal handlers
|
# * set -Ee: Exit on error, inherit ERR trap in functions
|
||||||
|
# * set -o pipefail: Pipeline fails if any command fails
|
||||||
|
# * set -u: (optional) Exit on undefined variable (if STRICT_UNSET=1)
|
||||||
|
# - Sets up traps:
|
||||||
|
# * ERR → error_handler (script errors)
|
||||||
|
# * EXIT → on_exit (any termination — cleanup + orphan detection)
|
||||||
|
# * INT → on_interrupt (Ctrl+C)
|
||||||
|
# * TERM → on_terminate (kill / systemd stop)
|
||||||
|
# * HUP → on_hangup (SSH disconnect / terminal closed)
|
||||||
# - Call this function early in every script
|
# - Call this function early in every script
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
catch_errors() {
|
catch_errors() {
|
||||||
|
|||||||
+1
-9
@@ -32,11 +32,6 @@ if ! command -v curl >/dev/null 2>&1; then
|
|||||||
apt update >/dev/null 2>&1
|
apt update >/dev/null 2>&1
|
||||||
apt install -y curl >/dev/null 2>&1
|
apt install -y curl >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
# Mark container context BEFORE error handling starts: error_handler/on_exit
|
|
||||||
# must write local failure artifacts instead of talking to the telemetry API
|
|
||||||
# (the host is the single telemetry reporter).
|
|
||||||
export TELEMETRY_CONTEXT="container"
|
|
||||||
|
|
||||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func)
|
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func)
|
||||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/error_handler.func)
|
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/error_handler.func)
|
||||||
load_functions
|
load_functions
|
||||||
@@ -70,12 +65,9 @@ post_progress_to_api() {
|
|||||||
|
|
||||||
local progress_status="${1:-configuring}"
|
local progress_status="${1:-configuring}"
|
||||||
|
|
||||||
# Progress pings are the ONLY telemetry a container sends (terminal statuses
|
|
||||||
# are reported by the host). Include execution_id + platform + repo
|
|
||||||
# attribution (exported by the host) so the server can correlate and filter.
|
|
||||||
curl -fsS -m 5 -X POST "https://telemetry.community-scripts.org/telemetry" \
|
curl -fsS -m 5 -X POST "https://telemetry.community-scripts.org/telemetry" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{\"random_id\":\"${RANDOM_UUID}\",\"execution_id\":\"${EXECUTION_ID:-${RANDOM_UUID}}\",\"type\":\"lxc\",\"nsapp\":\"${app:-unknown}\",\"status\":\"${progress_status}\",\"platform\":\"${TELEMETRY_PLATFORM:-}\",\"repo_source\":\"${REPO_SOURCE:-}\",\"repo_slug\":\"${REPO_SLUG:-}\"}" &>/dev/null || true
|
-d "{\"random_id\":\"${RANDOM_UUID}\",\"execution_id\":\"${EXECUTION_ID:-${RANDOM_UUID}}\",\"type\":\"lxc\",\"nsapp\":\"${app:-unknown}\",\"status\":\"${progress_status}\"}" &>/dev/null || true
|
||||||
}
|
}
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|||||||
+2
-4
@@ -573,10 +573,8 @@ cleanup() {
|
|||||||
if [[ $exit_code -ne 0 ]]; then
|
if [[ $exit_code -ne 0 ]]; then
|
||||||
post_update_to_api "failed" "$exit_code"
|
post_update_to_api "failed" "$exit_code"
|
||||||
else
|
else
|
||||||
# Exited cleanly but description()/success was never called: the user
|
# Exited cleanly but description()/success was never called — shouldn't happen
|
||||||
# backed out of a dialog. Report as aborted - NOT "failed 1" (which
|
post_update_to_api "failed" "1"
|
||||||
# produced meaningless 'General error' records with no error text).
|
|
||||||
post_update_to_api "aborted" "0"
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user