mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-02-19 03:25:55 +01:00
Compare commits
8 Commits
add-script
...
automated/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
829159133b | ||
|
|
b6a4e6a2a6 | ||
|
|
96c056ea4e | ||
|
|
491081ffbf | ||
|
|
1123fdca14 | ||
|
|
a3a383361d | ||
|
|
6cc8877852 | ||
|
|
845b89f975 |
@@ -406,6 +406,12 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
|
||||
|
||||
## 2026-02-18
|
||||
|
||||
### 🚀 Updated Scripts
|
||||
|
||||
- #### 💥 Breaking Changes
|
||||
|
||||
- [Fix] PatchMon: use `SERVER_PORT` in Nginx config if set in env [@vhsdream](https://github.com/vhsdream) ([#12053](https://github.com/community-scripts/ProxmoxVE/pull/12053))
|
||||
|
||||
### 💾 Core
|
||||
|
||||
- #### ✨ New Features
|
||||
|
||||
@@ -46,6 +46,7 @@ function update_script() {
|
||||
VERSION=$(get_latest_github_release "PatchMon/PatchMon")
|
||||
PROTO="$(sed -n '/SERVER_PROTOCOL/s/[^=]*=//p' /opt/backend.env)"
|
||||
HOST="$(sed -n '/SERVER_HOST/s/[^=]*=//p' /opt/backend.env)"
|
||||
SERVER_PORT="$(sed -n '/SERVER_PORT/s/[^=]*=//p' /opt/backend.env)"
|
||||
[[ "${PROTO:-http}" == "http" ]] && PORT=":3001"
|
||||
sed -i 's/PORT=3399/PORT=3001/' /opt/backend.env
|
||||
sed -i -e "s/VERSION=.*/VERSION=$VERSION/" \
|
||||
@@ -66,6 +67,9 @@ function update_script() {
|
||||
-e '\|try_files |i\ root /opt/patchmon/frontend/dist;' \
|
||||
-e 's|alias.*|alias /opt/patchmon/frontend/dist/assets;|' \
|
||||
-e '\|expires 1y|i\ root /opt/patchmon/frontend/dist;' /etc/nginx/sites-available/patchmon.conf
|
||||
if [[ -n "$SERVER_PORT" ]] && [[ "$SERVER_PORT" != "443" ]]; then
|
||||
sed -i "s/listen [[:digit:]]/listen ${SERVER_PORT};/" /etc/nginx/sites-available/patchmon.conf
|
||||
fi
|
||||
ln -sf /etc/nginx/sites-available/patchmon.conf /etc/nginx/sites-enabled/
|
||||
rm -f /etc/nginx/sites-enabled/default
|
||||
$STD nginx -t
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"generated": "2026-02-18T06:25:03Z",
|
||||
"generated": "2026-02-19T00:22:36Z",
|
||||
"versions": [
|
||||
{
|
||||
"slug": "2fauth",
|
||||
@@ -158,9 +158,9 @@
|
||||
{
|
||||
"slug": "bookstack",
|
||||
"repo": "BookStackApp/BookStack",
|
||||
"version": "v25.12.5",
|
||||
"version": "v25.12.6",
|
||||
"pinned": false,
|
||||
"date": "2026-02-17T18:42:47Z"
|
||||
"date": "2026-02-18T19:53:07Z"
|
||||
},
|
||||
{
|
||||
"slug": "byparr",
|
||||
@@ -256,9 +256,9 @@
|
||||
{
|
||||
"slug": "databasus",
|
||||
"repo": "databasus/databasus",
|
||||
"version": "v3.14.0",
|
||||
"version": "v3.14.1",
|
||||
"pinned": false,
|
||||
"date": "2026-02-17T17:18:34Z"
|
||||
"date": "2026-02-18T10:43:45Z"
|
||||
},
|
||||
{
|
||||
"slug": "dawarich",
|
||||
@@ -270,9 +270,9 @@
|
||||
{
|
||||
"slug": "discopanel",
|
||||
"repo": "nickheyer/discopanel",
|
||||
"version": "v1.0.36",
|
||||
"version": "v1.0.37",
|
||||
"pinned": false,
|
||||
"date": "2026-02-09T21:15:44Z"
|
||||
"date": "2026-02-18T08:53:43Z"
|
||||
},
|
||||
{
|
||||
"slug": "dispatcharr",
|
||||
@@ -417,9 +417,9 @@
|
||||
{
|
||||
"slug": "ghostfolio",
|
||||
"repo": "ghostfolio/ghostfolio",
|
||||
"version": "2.239.0",
|
||||
"version": "2.240.0",
|
||||
"pinned": false,
|
||||
"date": "2026-02-15T09:51:16Z"
|
||||
"date": "2026-02-18T20:08:56Z"
|
||||
},
|
||||
{
|
||||
"slug": "gitea",
|
||||
@@ -557,9 +557,9 @@
|
||||
{
|
||||
"slug": "huntarr",
|
||||
"repo": "plexguide/Huntarr.io",
|
||||
"version": "9.3.3",
|
||||
"version": "9.3.5",
|
||||
"pinned": false,
|
||||
"date": "2026-02-18T02:35:29Z"
|
||||
"date": "2026-02-18T16:25:07Z"
|
||||
},
|
||||
{
|
||||
"slug": "immich-public-proxy",
|
||||
@@ -585,9 +585,9 @@
|
||||
{
|
||||
"slug": "invoiceninja",
|
||||
"repo": "invoiceninja/invoiceninja",
|
||||
"version": "v5.12.63",
|
||||
"version": "v5.12.64",
|
||||
"pinned": false,
|
||||
"date": "2026-02-18T00:32:09Z"
|
||||
"date": "2026-02-18T07:59:44Z"
|
||||
},
|
||||
{
|
||||
"slug": "jackett",
|
||||
@@ -1061,9 +1061,9 @@
|
||||
{
|
||||
"slug": "pelican-panel",
|
||||
"repo": "pelican-dev/panel",
|
||||
"version": "v1.0.0-beta32",
|
||||
"version": "v1.0.0-beta33",
|
||||
"pinned": false,
|
||||
"date": "2026-02-09T22:15:44Z"
|
||||
"date": "2026-02-18T21:37:11Z"
|
||||
},
|
||||
{
|
||||
"slug": "pelican-wings",
|
||||
@@ -1187,9 +1187,9 @@
|
||||
{
|
||||
"slug": "pulse",
|
||||
"repo": "rcourtman/Pulse",
|
||||
"version": "v5.1.9",
|
||||
"version": "v5.1.10",
|
||||
"pinned": false,
|
||||
"date": "2026-02-11T15:34:40Z"
|
||||
"date": "2026-02-18T14:00:51Z"
|
||||
},
|
||||
{
|
||||
"slug": "pve-scripts-local",
|
||||
@@ -1313,9 +1313,9 @@
|
||||
{
|
||||
"slug": "scanopy",
|
||||
"repo": "scanopy/scanopy",
|
||||
"version": "v0.14.4",
|
||||
"version": "v0.14.6",
|
||||
"pinned": false,
|
||||
"date": "2026-02-10T03:57:28Z"
|
||||
"date": "2026-02-18T16:54:14Z"
|
||||
},
|
||||
{
|
||||
"slug": "scraparr",
|
||||
@@ -1341,9 +1341,9 @@
|
||||
{
|
||||
"slug": "semaphore",
|
||||
"repo": "semaphoreui/semaphore",
|
||||
"version": "v2.17.5",
|
||||
"version": "v2.17.8",
|
||||
"pinned": false,
|
||||
"date": "2026-02-17T18:20:38Z"
|
||||
"date": "2026-02-18T19:46:43Z"
|
||||
},
|
||||
{
|
||||
"slug": "shelfmark",
|
||||
@@ -1418,9 +1418,9 @@
|
||||
{
|
||||
"slug": "stirling-pdf",
|
||||
"repo": "Stirling-Tools/Stirling-PDF",
|
||||
"version": "v2.5.0",
|
||||
"version": "v2.5.1",
|
||||
"pinned": false,
|
||||
"date": "2026-02-16T22:58:17Z"
|
||||
"date": "2026-02-18T11:05:34Z"
|
||||
},
|
||||
{
|
||||
"slug": "streamlink-webui",
|
||||
@@ -1607,9 +1607,9 @@
|
||||
{
|
||||
"slug": "victoriametrics",
|
||||
"repo": "VictoriaMetrics/VictoriaMetrics",
|
||||
"version": "v1.135.0",
|
||||
"version": "v1.136.0",
|
||||
"pinned": false,
|
||||
"date": "2026-02-02T14:20:15Z"
|
||||
"date": "2026-02-16T13:17:50Z"
|
||||
},
|
||||
{
|
||||
"slug": "vikunja",
|
||||
@@ -1726,9 +1726,9 @@
|
||||
{
|
||||
"slug": "yubal",
|
||||
"repo": "guillevc/yubal",
|
||||
"version": "v0.6.0",
|
||||
"version": "v0.6.1",
|
||||
"pinned": false,
|
||||
"date": "2026-02-15T17:47:56Z"
|
||||
"date": "2026-02-18T23:24:16Z"
|
||||
},
|
||||
{
|
||||
"slug": "zigbee2mqtt",
|
||||
|
||||
@@ -148,6 +148,7 @@ motd_ssh() {
|
||||
# Start the sshd service
|
||||
$STD /etc/init.d/sshd start
|
||||
fi
|
||||
post_progress_to_api
|
||||
}
|
||||
|
||||
# Validate Timezone for some LXC's
|
||||
@@ -184,5 +185,5 @@ EOF
|
||||
|
||||
echo "bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/${app}.sh)\"" >/usr/bin/update
|
||||
chmod +x /usr/bin/update
|
||||
|
||||
post_progress_to_api
|
||||
}
|
||||
|
||||
@@ -688,6 +688,29 @@ EOF
|
||||
POST_TO_API_DONE=true
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# post_progress_to_api()
|
||||
#
|
||||
# - Lightweight progress ping from host or container
|
||||
# - Updates the existing telemetry record status 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
|
||||
# - Can be called multiple times safely
|
||||
# ------------------------------------------------------------------------------
|
||||
post_progress_to_api() {
|
||||
command -v curl &>/dev/null || return 0
|
||||
[[ "${DIAGNOSTICS:-no}" == "no" ]] && return 0
|
||||
[[ -z "${RANDOM_UUID:-}" ]] && return 0
|
||||
|
||||
local app_name="${NSAPP:-${app:-unknown}}"
|
||||
local telemetry_type="${TELEMETRY_TYPE:-lxc}"
|
||||
|
||||
curl -fsS -m 5 -X POST "${TELEMETRY_URL:-https://telemetry.community-scripts.org/telemetry}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"random_id\":\"${RANDOM_UUID}\",\"execution_id\":\"${EXECUTION_ID:-${RANDOM_UUID}}\",\"type\":\"${telemetry_type}\",\"nsapp\":\"${app_name}\",\"status\":\"configuring\"}" &>/dev/null || true
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# post_update_to_api()
|
||||
#
|
||||
|
||||
@@ -3660,9 +3660,6 @@ $PCT_OPTIONS_STRING"
|
||||
exit 214
|
||||
fi
|
||||
msg_ok "Storage space validated"
|
||||
|
||||
# Report installation start to API (early - captures failed installs too)
|
||||
post_to_api
|
||||
fi
|
||||
|
||||
create_lxc_container || exit $?
|
||||
@@ -3908,6 +3905,7 @@ EOF
|
||||
for i in {1..10}; do
|
||||
if pct status "$CTID" | grep -q "status: running"; then
|
||||
msg_ok "Started LXC Container"
|
||||
post_progress_to_api # Signal container is running
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
@@ -3962,6 +3960,7 @@ EOF
|
||||
echo -e "${YW}Container may have limited internet access. Installation will continue...${CL}"
|
||||
else
|
||||
msg_ok "Network in LXC is reachable (ping)"
|
||||
post_progress_to_api # Signal network is ready
|
||||
fi
|
||||
fi
|
||||
# Function to get correct GID inside container
|
||||
@@ -4033,6 +4032,7 @@ EOF'
|
||||
fi
|
||||
|
||||
msg_ok "Customized LXC Container"
|
||||
post_progress_to_api # Signal ready for app installation
|
||||
|
||||
# Optional DNS override for retry scenarios (inside LXC, never on host)
|
||||
if [[ "${DNS_RETRY_OVERRIDE:-false}" == "true" ]]; then
|
||||
@@ -4106,9 +4106,9 @@ EOF'
|
||||
build_log_copied=true
|
||||
fi
|
||||
|
||||
# Copy and append INSTALL_LOG from container
|
||||
# Copy and append INSTALL_LOG from container (with timeout to prevent hangs)
|
||||
local temp_install_log="/tmp/.install-temp-${SESSION_ID}.log"
|
||||
if pct pull "$CTID" "/root/.install-${SESSION_ID}.log" "$temp_install_log" 2>/dev/null; then
|
||||
if timeout 8 pct pull "$CTID" "/root/.install-${SESSION_ID}.log" "$temp_install_log" 2>/dev/null; then
|
||||
{
|
||||
echo "================================================================================"
|
||||
echo "PHASE 2: APPLICATION INSTALLATION (Container)"
|
||||
@@ -4888,6 +4888,9 @@ create_lxc_container() {
|
||||
exit 206
|
||||
fi
|
||||
|
||||
# Report installation start to API early - captures failures in storage/template/create
|
||||
post_to_api
|
||||
|
||||
# Storage capability check
|
||||
check_storage_support "rootdir" || {
|
||||
msg_error "No valid storage found for 'rootdir' [Container]"
|
||||
@@ -5417,9 +5420,7 @@ create_lxc_container() {
|
||||
}
|
||||
|
||||
msg_ok "LXC Container ${BL}$CTID${CL} ${GN}was successfully created."
|
||||
|
||||
# Report container creation to API
|
||||
post_to_api
|
||||
post_progress_to_api # Signal container creation complete
|
||||
}
|
||||
|
||||
# ==============================================================================
|
||||
@@ -5492,6 +5493,7 @@ EOF
|
||||
# - If INSTALL_LOG points to a container path (e.g. /root/.install-*),
|
||||
# tries to pull it from the container and create a combined log
|
||||
# - This allows get_error_text() to find actual error output for telemetry
|
||||
# - Uses timeout on pct pull to prevent hangs on dead/unresponsive containers
|
||||
# ------------------------------------------------------------------------------
|
||||
ensure_log_on_host() {
|
||||
# Already readable on host? Nothing to do.
|
||||
@@ -5521,9 +5523,9 @@ ensure_log_on_host() {
|
||||
echo ""
|
||||
} >>"$combined_log"
|
||||
fi
|
||||
# Pull INSTALL_LOG from container
|
||||
# Pull INSTALL_LOG from container (with timeout to prevent hangs on dead containers)
|
||||
local temp_log="/tmp/.install-temp-${SESSION_ID}.log"
|
||||
if pct pull "$CTID" "/root/.install-${SESSION_ID}.log" "$temp_log" 2>/dev/null; then
|
||||
if timeout 8 pct pull "$CTID" "/root/.install-${SESSION_ID}.log" "$temp_log" 2>/dev/null; then
|
||||
{
|
||||
echo "================================================================================"
|
||||
echo "PHASE 2: APPLICATION INSTALLATION (Container)"
|
||||
@@ -5546,8 +5548,8 @@ ensure_log_on_host() {
|
||||
# - Exit trap handler for reporting to API telemetry
|
||||
# - Captures exit code and reports to PocketBase using centralized error descriptions
|
||||
# - Uses explain_exit_code() from api.func for consistent error messages
|
||||
# - For signal exits (>128): sends telemetry FIRST before log collection
|
||||
# to prevent pct pull hangs from blocking status updates
|
||||
# - ALWAYS sends telemetry FIRST before log collection to prevent pct pull
|
||||
# hangs from blocking status updates (container may be dead/unresponsive)
|
||||
# - For non-zero exit codes: posts "failed" status
|
||||
# - For zero exit codes where post_update_to_api was never called:
|
||||
# catches orphaned "installing" records (e.g., script exited cleanly
|
||||
@@ -5556,14 +5558,12 @@ ensure_log_on_host() {
|
||||
api_exit_script() {
|
||||
local exit_code=$?
|
||||
if [ $exit_code -ne 0 ]; then
|
||||
if [ $exit_code -gt 128 ]; then
|
||||
# Signal exit: send telemetry IMMEDIATELY (container may be dying)
|
||||
post_update_to_api "failed" "$exit_code" 2>/dev/null || true
|
||||
ensure_log_on_host 2>/dev/null || true
|
||||
else
|
||||
# Normal error: collect logs first for better error details
|
||||
ensure_log_on_host 2>/dev/null || true
|
||||
post_update_to_api "failed" "$exit_code"
|
||||
# ALWAYS send telemetry FIRST - ensure status is reported even if
|
||||
# ensure_log_on_host hangs (e.g. pct pull on dead container)
|
||||
post_update_to_api "failed" "$exit_code" 2>/dev/null || true
|
||||
# Best-effort log collection with timeout (non-critical after telemetry is sent)
|
||||
if declare -f ensure_log_on_host >/dev/null 2>&1; then
|
||||
timeout 10 bash -c 'ensure_log_on_host' 2>/dev/null || true
|
||||
fi
|
||||
elif [[ "${POST_TO_API_DONE:-}" == "true" && "${POST_UPDATE_DONE:-}" != "true" ]]; then
|
||||
# Script exited with 0 but never sent a completion status
|
||||
@@ -5575,7 +5575,7 @@ api_exit_script() {
|
||||
if command -v pveversion >/dev/null 2>&1; then
|
||||
trap 'api_exit_script' EXIT
|
||||
fi
|
||||
trap 'local _ec=$?; if [[ $_ec -ne 0 ]]; then ensure_log_on_host 2>/dev/null || true; post_update_to_api "failed" "$_ec"; fi' ERR
|
||||
trap 'post_update_to_api "failed" "129" 2>/dev/null || true; ensure_log_on_host 2>/dev/null || true; exit 129' SIGHUP
|
||||
trap 'post_update_to_api "failed" "130" 2>/dev/null || true; ensure_log_on_host 2>/dev/null || true; exit 130' SIGINT
|
||||
trap 'post_update_to_api "failed" "143" 2>/dev/null || true; ensure_log_on_host 2>/dev/null || true; exit 143' SIGTERM
|
||||
trap 'local _ec=$?; if [[ $_ec -ne 0 ]]; then post_update_to_api "failed" "$_ec" 2>/dev/null || true; timeout 10 bash -c "ensure_log_on_host" 2>/dev/null || true; fi' ERR
|
||||
trap 'post_update_to_api "failed" "129" 2>/dev/null || true; timeout 10 bash -c "ensure_log_on_host" 2>/dev/null || true; exit 129' SIGHUP
|
||||
trap 'post_update_to_api "failed" "130" 2>/dev/null || true; timeout 10 bash -c "ensure_log_on_host" 2>/dev/null || true; exit 130' SIGINT
|
||||
trap 'post_update_to_api "failed" "143" 2>/dev/null || true; timeout 10 bash -c "ensure_log_on_host" 2>/dev/null || true; exit 143' SIGTERM
|
||||
|
||||
@@ -1496,6 +1496,11 @@ cleanup_lxc() {
|
||||
fi
|
||||
|
||||
msg_ok "Cleaned"
|
||||
|
||||
# Send progress ping if available (defined in install.func)
|
||||
if declare -f post_progress_to_api &>/dev/null; then
|
||||
post_progress_to_api
|
||||
fi
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
@@ -204,6 +204,12 @@ error_handler() {
|
||||
|
||||
printf "\e[?25h"
|
||||
|
||||
# ALWAYS report failure to API immediately - don't wait for container checks
|
||||
# This ensures we capture failures that occur before/after container exists
|
||||
if declare -f post_update_to_api &>/dev/null; then
|
||||
post_update_to_api "failed" "$exit_code" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Use msg_error if available, fallback to echo
|
||||
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}"
|
||||
@@ -254,11 +260,6 @@ error_handler() {
|
||||
|
||||
# Offer to remove container if it exists (build errors after container creation)
|
||||
if [[ -n "${CTID:-}" ]] && command -v pct &>/dev/null && pct status "$CTID" &>/dev/null; then
|
||||
# Report failure to API before container cleanup
|
||||
if declare -f post_update_to_api &>/dev/null; then
|
||||
post_update_to_api "failed" "$exit_code"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
if declare -f msg_custom >/dev/null 2>&1; then
|
||||
echo -en "${TAB}❓${TAB}${YW}Remove broken container ${CTID}? (Y/n) [auto-remove in 60s]: ${CL}"
|
||||
@@ -339,24 +340,17 @@ on_exit() {
|
||||
# post_to_api was called ("installing" sent) but post_update_to_api was never called
|
||||
if [[ "${POST_TO_API_DONE:-}" == "true" && "${POST_UPDATE_DONE:-}" != "true" ]]; then
|
||||
if declare -f post_update_to_api >/dev/null 2>&1; then
|
||||
if [[ $exit_code -gt 128 ]]; then
|
||||
# Signal exit: send telemetry IMMEDIATELY (container may be dying, pct pull could hang)
|
||||
# ALWAYS send telemetry FIRST - ensure status is reported even if
|
||||
# ensure_log_on_host hangs (e.g. pct pull on dead/unresponsive container)
|
||||
if [[ $exit_code -ne 0 ]]; then
|
||||
post_update_to_api "failed" "$exit_code" 2>/dev/null || true
|
||||
# Then try log collection (non-critical, best-effort)
|
||||
if declare -f ensure_log_on_host >/dev/null 2>&1; then
|
||||
ensure_log_on_host 2>/dev/null || true
|
||||
fi
|
||||
else
|
||||
# Normal exit: collect logs first for better error details
|
||||
if declare -f ensure_log_on_host >/dev/null 2>&1; then
|
||||
ensure_log_on_host 2>/dev/null || true
|
||||
fi
|
||||
if [[ $exit_code -ne 0 ]]; then
|
||||
post_update_to_api "failed" "$exit_code"
|
||||
else
|
||||
# exit_code=0 is never an error — report as success
|
||||
post_update_to_api "done" "0"
|
||||
fi
|
||||
# exit_code=0 is never an error — report as success
|
||||
post_update_to_api "done" "0" 2>/dev/null || true
|
||||
fi
|
||||
# Best-effort log collection with timeout (non-critical after telemetry is sent)
|
||||
if declare -f ensure_log_on_host >/dev/null 2>&1; then
|
||||
timeout 10 bash -c 'ensure_log_on_host' 2>/dev/null || true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@@ -380,9 +374,9 @@ on_interrupt() {
|
||||
if declare -f post_update_to_api >/dev/null 2>&1; then
|
||||
post_update_to_api "failed" "130" 2>/dev/null || true
|
||||
fi
|
||||
# Best-effort log collection (non-critical after telemetry is sent)
|
||||
# Best-effort log collection with timeout (non-critical after telemetry is sent)
|
||||
if declare -f ensure_log_on_host >/dev/null 2>&1; then
|
||||
ensure_log_on_host 2>/dev/null || true
|
||||
timeout 10 bash -c 'ensure_log_on_host' 2>/dev/null || true
|
||||
fi
|
||||
if declare -f msg_error >/dev/null 2>&1; then
|
||||
msg_error "Interrupted by user (SIGINT)" 2>/dev/null || true
|
||||
@@ -409,9 +403,9 @@ on_terminate() {
|
||||
if declare -f post_update_to_api >/dev/null 2>&1; then
|
||||
post_update_to_api "failed" "143" 2>/dev/null || true
|
||||
fi
|
||||
# Best-effort log collection (non-critical after telemetry is sent)
|
||||
# Best-effort log collection with timeout (non-critical after telemetry is sent)
|
||||
if declare -f ensure_log_on_host >/dev/null 2>&1; then
|
||||
ensure_log_on_host 2>/dev/null || true
|
||||
timeout 10 bash -c 'ensure_log_on_host' 2>/dev/null || true
|
||||
fi
|
||||
if declare -f msg_error >/dev/null 2>&1; then
|
||||
msg_error "Terminated by signal (SIGTERM)" 2>/dev/null || true
|
||||
|
||||
@@ -285,6 +285,7 @@ motd_ssh() {
|
||||
sed -i "s/#PermitRootLogin prohibit-password/PermitRootLogin yes/g" /etc/ssh/sshd_config
|
||||
systemctl restart sshd
|
||||
fi
|
||||
post_progress_to_api
|
||||
}
|
||||
|
||||
# ==============================================================================
|
||||
@@ -323,4 +324,5 @@ EOF
|
||||
chmod 700 /root/.ssh
|
||||
chmod 600 /root/.ssh/authorized_keys
|
||||
fi
|
||||
post_progress_to_api
|
||||
}
|
||||
|
||||
@@ -91,6 +91,17 @@ function cleanup() {
|
||||
rm -rf $TEMP_DIR
|
||||
}
|
||||
|
||||
function check_disk_space() {
|
||||
local path="$1"
|
||||
local required_gb="$2"
|
||||
local available_kb=$(df -k "$path" | awk 'NR==2 {print $4}')
|
||||
local available_gb=$((available_kb / 1024 / 1024))
|
||||
if [ $available_gb -lt $required_gb ]; then
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
TEMP_DIR=$(mktemp -d)
|
||||
pushd $TEMP_DIR >/dev/null
|
||||
function send_line_to_vm() {
|
||||
@@ -605,11 +616,41 @@ if [ -z "$URL" ]; then
|
||||
exit 1
|
||||
fi
|
||||
msg_ok "Download URL: ${CL}${BL}${URL}${CL}"
|
||||
|
||||
# Check available disk space (require at least 20GB for safety)
|
||||
if ! check_disk_space "$TEMP_DIR" 20; then
|
||||
AVAILABLE_GB=$(df -h "$TEMP_DIR" | awk 'NR==2 {print $4}')
|
||||
msg_error "Insufficient disk space in temporary directory ($TEMP_DIR)."
|
||||
msg_error "Available: ${AVAILABLE_GB}, Required: ~20GB for FreeBSD image decompression."
|
||||
msg_error "Please free up space or ensure /tmp has sufficient storage."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
msg_info "Downloading FreeBSD Image"
|
||||
curl -f#SL -o "$(basename "$URL")" "$URL"
|
||||
echo -en "\e[1A\e[0K"
|
||||
msg_ok "Downloaded ${CL}${BL}$(basename "$URL")${CL}"
|
||||
|
||||
# Check disk space again before decompression
|
||||
if ! check_disk_space "$TEMP_DIR" 15; then
|
||||
AVAILABLE_GB=$(df -h "$TEMP_DIR" | awk 'NR==2 {print $4}')
|
||||
msg_error "Insufficient disk space for decompression."
|
||||
msg_error "Available: ${AVAILABLE_GB}, Required: ~15GB for decompressed image."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
msg_info "Decompressing FreeBSD Image (this may take a few minutes)"
|
||||
FILE=FreeBSD.qcow2
|
||||
unxz -cv $(basename $URL) >${FILE}
|
||||
msg_ok "Downloaded ${CL}${BL}${FILE}${CL}"
|
||||
if ! unxz -cv $(basename $URL) >${FILE}; then
|
||||
msg_error "Failed to decompress FreeBSD image."
|
||||
msg_error "This is usually caused by insufficient disk space."
|
||||
df -h "$TEMP_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Remove the compressed file to save space
|
||||
rm -f "$(basename "$URL")"
|
||||
msg_ok "Decompressed ${CL}${BL}${FILE}${CL}"
|
||||
|
||||
STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}')
|
||||
case $STORAGE_TYPE in
|
||||
@@ -649,7 +690,7 @@ qm set $VMID \
|
||||
-boot order=scsi0 \
|
||||
-serial0 socket \
|
||||
-tags community-script >/dev/null
|
||||
qm resize $VMID scsi0 10G >/dev/null
|
||||
qm resize $VMID scsi0 20G >/dev/null
|
||||
DESCRIPTION=$(
|
||||
cat <<EOF
|
||||
<div align='center'>
|
||||
|
||||
Reference in New Issue
Block a user