mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-02-18 03:03:25 +01:00
Compare commits
3 Commits
github-act
...
feature/te
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8864e9aa9d | ||
|
|
16a0329af3 | ||
|
|
50effb6d86 |
@@ -14,6 +14,25 @@ catch_errors
|
|||||||
# Get LXC IP address (must be called INSIDE container, after network is up)
|
# Get LXC IP address (must be called INSIDE container, after network is up)
|
||||||
get_lxc_ip
|
get_lxc_ip
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# post_progress_to_api()
|
||||||
|
#
|
||||||
|
# - Lightweight progress ping from inside the container
|
||||||
|
# - Updates the existing telemetry record status from "installing" to "configuring"
|
||||||
|
# - Signals that the installation is actively progressing (not stuck)
|
||||||
|
# - Fire-and-forget: never blocks or fails the script
|
||||||
|
# - Only executes if DIAGNOSTICS=yes and RANDOM_UUID is set
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
post_progress_to_api() {
|
||||||
|
command -v curl &>/dev/null || return 0
|
||||||
|
[[ "${DIAGNOSTICS:-no}" == "no" ]] && return 0
|
||||||
|
[[ -z "${RANDOM_UUID:-}" ]] && return 0
|
||||||
|
|
||||||
|
curl -fsS -m 5 -X POST "https://telemetry.community-scripts.org/telemetry" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"random_id\":\"${RANDOM_UUID}\",\"type\":\"lxc\",\"nsapp\":\"${app:-unknown}\",\"status\":\"configuring\"}" &>/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
|
||||||
verb_ip6() {
|
verb_ip6() {
|
||||||
set_std_mode # Set STD mode based on VERBOSE
|
set_std_mode # Set STD mode based on VERBOSE
|
||||||
@@ -53,6 +72,7 @@ setting_up_container() {
|
|||||||
fi
|
fi
|
||||||
msg_ok "Set up Container OS"
|
msg_ok "Set up Container OS"
|
||||||
msg_ok "Network Connected: ${BL}$(ip addr show | grep 'inet ' | awk '{print $2}' | cut -d'/' -f1 | tail -n1)${CL}"
|
msg_ok "Network Connected: ${BL}$(ip addr show | grep 'inet ' | awk '{print $2}' | cut -d'/' -f1 | tail -n1)${CL}"
|
||||||
|
post_progress_to_api
|
||||||
}
|
}
|
||||||
|
|
||||||
# This function checks the network connection by pinging a known IP address and prompts the user to continue if the internet is not connected
|
# This function checks the network connection by pinging a known IP address and prompts the user to continue if the internet is not connected
|
||||||
@@ -85,8 +105,18 @@ network_check() {
|
|||||||
update_os() {
|
update_os() {
|
||||||
msg_info "Updating Container OS"
|
msg_info "Updating Container OS"
|
||||||
$STD apk -U upgrade
|
$STD apk -U upgrade
|
||||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/tools.func)
|
local tools_content
|
||||||
|
tools_content=$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/tools.func) || {
|
||||||
|
msg_error "Failed to download tools.func"
|
||||||
|
exit 6
|
||||||
|
}
|
||||||
|
source /dev/stdin <<<"$tools_content"
|
||||||
|
if ! declare -f fetch_and_deploy_gh_release >/dev/null 2>&1; then
|
||||||
|
msg_error "tools.func loaded but incomplete — missing expected functions"
|
||||||
|
exit 6
|
||||||
|
fi
|
||||||
msg_ok "Updated Container OS"
|
msg_ok "Updated Container OS"
|
||||||
|
post_progress_to_api
|
||||||
}
|
}
|
||||||
|
|
||||||
# This function modifies the message of the day (motd) and SSH settings
|
# This function modifies the message of the day (motd) and SSH settings
|
||||||
|
|||||||
@@ -908,6 +908,9 @@ categorize_error() {
|
|||||||
# Network errors (curl/wget)
|
# Network errors (curl/wget)
|
||||||
6 | 7 | 22 | 35) echo "network" ;;
|
6 | 7 | 22 | 35) echo "network" ;;
|
||||||
|
|
||||||
|
# Docker / Privileged mode required
|
||||||
|
10) echo "config" ;;
|
||||||
|
|
||||||
# Timeout errors
|
# Timeout errors
|
||||||
28 | 124 | 211) echo "timeout" ;;
|
28 | 124 | 211) echo "timeout" ;;
|
||||||
|
|
||||||
|
|||||||
@@ -5564,15 +5564,15 @@ api_exit_script() {
|
|||||||
post_update_to_api "failed" "$exit_code"
|
post_update_to_api "failed" "$exit_code"
|
||||||
elif [[ "${POST_TO_API_DONE:-}" == "true" && "${POST_UPDATE_DONE:-}" != "true" ]]; then
|
elif [[ "${POST_TO_API_DONE:-}" == "true" && "${POST_UPDATE_DONE:-}" != "true" ]]; then
|
||||||
# Script exited with 0 but never sent a completion status
|
# Script exited with 0 but never sent a completion status
|
||||||
# This catches edge cases like early returns after post_to_api()
|
# exit_code=0 is never an error — report as success
|
||||||
post_update_to_api "failed" "1"
|
post_update_to_api "done" "0"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if command -v pveversion >/dev/null 2>&1; then
|
if command -v pveversion >/dev/null 2>&1; then
|
||||||
trap 'api_exit_script' EXIT
|
trap 'api_exit_script' EXIT
|
||||||
fi
|
fi
|
||||||
trap '_ERR_CODE=$?; ensure_log_on_host; post_update_to_api "failed" "$_ERR_CODE"' ERR
|
trap 'local _ec=$?; if [[ $_ec -ne 0 ]]; then ensure_log_on_host; post_update_to_api "failed" "$_ec"; fi' ERR
|
||||||
trap 'ensure_log_on_host; post_update_to_api "failed" "129"; exit 129' SIGHUP
|
trap 'ensure_log_on_host; post_update_to_api "failed" "129"; exit 129' SIGHUP
|
||||||
trap 'ensure_log_on_host; post_update_to_api "failed" "130"; exit 130' SIGINT
|
trap 'ensure_log_on_host; post_update_to_api "failed" "130"; exit 130' SIGINT
|
||||||
trap 'ensure_log_on_host; post_update_to_api "failed" "143"; exit 143' SIGTERM
|
trap 'ensure_log_on_host; post_update_to_api "failed" "143"; exit 143' SIGTERM
|
||||||
|
|||||||
@@ -40,6 +40,25 @@ catch_errors
|
|||||||
# Get LXC IP address (must be called INSIDE container, after network is up)
|
# Get LXC IP address (must be called INSIDE container, after network is up)
|
||||||
get_lxc_ip
|
get_lxc_ip
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# post_progress_to_api()
|
||||||
|
#
|
||||||
|
# - Lightweight progress ping from inside the container
|
||||||
|
# - Updates the existing telemetry record status from "installing" to "configuring"
|
||||||
|
# - Signals that the installation is actively progressing (not stuck)
|
||||||
|
# - Fire-and-forget: never blocks or fails the script
|
||||||
|
# - Only executes if DIAGNOSTICS=yes and RANDOM_UUID is set
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
post_progress_to_api() {
|
||||||
|
command -v curl &>/dev/null || return 0
|
||||||
|
[[ "${DIAGNOSTICS:-no}" == "no" ]] && return 0
|
||||||
|
[[ -z "${RANDOM_UUID:-}" ]] && return 0
|
||||||
|
|
||||||
|
curl -fsS -m 5 -X POST "https://telemetry.community-scripts.org/telemetry" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"random_id\":\"${RANDOM_UUID}\",\"type\":\"lxc\",\"nsapp\":\"${app:-unknown}\",\"status\":\"configuring\"}" &>/dev/null || true
|
||||||
|
}
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# SECTION 2: NETWORK & CONNECTIVITY
|
# SECTION 2: NETWORK & CONNECTIVITY
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
@@ -103,6 +122,7 @@ setting_up_container() {
|
|||||||
msg_ok "Set up Container OS"
|
msg_ok "Set up Container OS"
|
||||||
#msg_custom "${CM}" "${GN}" "Network Connected: ${BL}$(hostname -I)"
|
#msg_custom "${CM}" "${GN}" "Network Connected: ${BL}$(hostname -I)"
|
||||||
msg_ok "Network Connected: ${BL}$(hostname -I)"
|
msg_ok "Network Connected: ${BL}$(hostname -I)"
|
||||||
|
post_progress_to_api
|
||||||
}
|
}
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
@@ -206,8 +226,18 @@ EOF
|
|||||||
$STD apt-get -o Dpkg::Options::="--force-confold" -y dist-upgrade
|
$STD apt-get -o Dpkg::Options::="--force-confold" -y dist-upgrade
|
||||||
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
|
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
|
||||||
msg_ok "Updated Container OS"
|
msg_ok "Updated Container OS"
|
||||||
|
post_progress_to_api
|
||||||
|
|
||||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/tools.func)
|
local tools_content
|
||||||
|
tools_content=$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/tools.func) || {
|
||||||
|
msg_error "Failed to download tools.func"
|
||||||
|
exit 6
|
||||||
|
}
|
||||||
|
source /dev/stdin <<<"$tools_content"
|
||||||
|
if ! declare -f fetch_and_deploy_gh_release >/dev/null 2>&1; then
|
||||||
|
msg_error "tools.func loaded but incomplete — missing expected functions"
|
||||||
|
exit 6
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user