Compare commits

..

1 Commits

Author SHA1 Message Date
MickLesk 3b45fc21ef fix(librenms): run daily.sh as librenms user with git available
Install git, initialize git metadata for tarball deployments, and execute
daily.sh via su so updates no longer fail with permission or missing git.
2026-06-22 21:39:17 +02:00
12 changed files with 88 additions and 145 deletions
-18
View File
@@ -496,9 +496,6 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
- #### 🐞 Bug Fixes - #### 🐞 Bug Fixes
- invoiceshelf: use pnpm instead of yarn for frontend build [@MickLesk](https://github.com/MickLesk) ([#15312](https://github.com/community-scripts/ProxmoxVE/pull/15312))
- VictoriaMetrics: resolve architecture before jq asset filter [@MickLesk](https://github.com/MickLesk) ([#15316](https://github.com/community-scripts/ProxmoxVE/pull/15316))
- Endurain: pin uv to the version required by the project [@MickLesk](https://github.com/MickLesk) ([#15313](https://github.com/community-scripts/ProxmoxVE/pull/15313))
- add proxy headers to dispatcharr from #15143 [@asylumexp](https://github.com/asylumexp) ([#15293](https://github.com/community-scripts/ProxmoxVE/pull/15293)) - add proxy headers to dispatcharr from #15143 [@asylumexp](https://github.com/asylumexp) ([#15293](https://github.com/community-scripts/ProxmoxVE/pull/15293))
- Fix-15015: check correct path for certbot [@galz55](https://github.com/galz55) ([#15034](https://github.com/community-scripts/ProxmoxVE/pull/15034)) - Fix-15015: check correct path for certbot [@galz55](https://github.com/galz55) ([#15034](https://github.com/community-scripts/ProxmoxVE/pull/15034))
- fix(romm): resolve 403 Forbidden error on nginx mod_zip installation [@hug-efrei](https://github.com/hug-efrei) ([#15134](https://github.com/community-scripts/ProxmoxVE/pull/15134)) - fix(romm): resolve 403 Forbidden error on nginx mod_zip installation [@hug-efrei](https://github.com/hug-efrei) ([#15134](https://github.com/community-scripts/ProxmoxVE/pull/15134))
@@ -508,31 +505,16 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
- #### ✨ New Features - #### ✨ New Features
- update: esphome to install and run ESPHome Device Builder [@jesserockz](https://github.com/jesserockz) ([#15195](https://github.com/community-scripts/ProxmoxVE/pull/15195))
- [arm64] Port scripts between warracker-zwavejsui to support arm64 [@asylumexp](https://github.com/asylumexp) ([#15291](https://github.com/community-scripts/ProxmoxVE/pull/15291)) - [arm64] Port scripts between warracker-zwavejsui to support arm64 [@asylumexp](https://github.com/asylumexp) ([#15291](https://github.com/community-scripts/ProxmoxVE/pull/15291))
- [arm64] Port scripts between thingsboard & wanderer to support arm64 [@asylumexp](https://github.com/asylumexp) ([#15286](https://github.com/community-scripts/ProxmoxVE/pull/15286)) - [arm64] Port scripts between thingsboard & wanderer to support arm64 [@asylumexp](https://github.com/asylumexp) ([#15286](https://github.com/community-scripts/ProxmoxVE/pull/15286))
- [arm64] Port scripts between snowshare & thelounge to support arm64 [@asylumexp](https://github.com/asylumexp) ([#15280](https://github.com/community-scripts/ProxmoxVE/pull/15280)) - [arm64] Port scripts between snowshare & thelounge to support arm64 [@asylumexp](https://github.com/asylumexp) ([#15280](https://github.com/community-scripts/ProxmoxVE/pull/15280))
### 💾 Core ### 💾 Core
- #### 🐞 Bug Fixes
- tools.func: refresh ruby-build when requested version is missing [@MickLesk](https://github.com/MickLesk) ([#15315](https://github.com/community-scripts/ProxmoxVE/pull/15315))
- #### ✨ New Features - #### ✨ New Features
- core: add pre-install storage health checks [@MickLesk](https://github.com/MickLesk) ([#15226](https://github.com/community-scripts/ProxmoxVE/pull/15226)) - core: add pre-install storage health checks [@MickLesk](https://github.com/MickLesk) ([#15226](https://github.com/community-scripts/ProxmoxVE/pull/15226))
- #### 🔧 Refactor
- core:: skip LXC stack upgrade prompt in unattended mode [@MickLesk](https://github.com/MickLesk) ([#15319](https://github.com/community-scripts/ProxmoxVE/pull/15319))
### 🧰 Tools
- #### 🔧 Refactor
- update-apps: sanitize service detection and fail on invalid names [@MickLesk](https://github.com/MickLesk) ([#15318](https://github.com/community-scripts/ProxmoxVE/pull/15318))
## 2026-06-21 ## 2026-06-21
### 🚀 Updated Scripts ### 🚀 Updated Scripts
-2
View File
@@ -61,8 +61,6 @@ function update_script() {
msg_info "Updating Backend" msg_info "Updating Backend"
cd /opt/endurain/backend cd /opt/endurain/backend
UV_VERSION=$(grep -Po 'required-version\s*=\s*"\K[^"]+' pyproject.toml 2>/dev/null || echo "0.11.18")
UV_VERSION="$UV_VERSION" setup_uv
$STD poetry export -f requirements.txt --output requirements.txt --without-hashes $STD poetry export -f requirements.txt --output requirements.txt --without-hashes
$STD uv venv --clear $STD uv venv --clear
$STD uv pip install -r requirements.txt $STD uv pip install -r requirements.txt
+16 -20
View File
@@ -24,14 +24,13 @@ function update_script() {
header_info header_info
check_container_storage check_container_storage
check_container_resources check_container_resources
if [[ ! -f /etc/systemd/system/esphome-device-builder.service && ! -f /etc/systemd/system/esphomeDashboard.service ]]; then if [[ ! -f /etc/systemd/system/esphomeDashboard.service ]]; then
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit exit
fi fi
msg_info "Stopping Service" msg_info "Stopping Service"
systemctl stop esphome-device-builder 2>/dev/null || true systemctl stop esphomeDashboard
systemctl stop esphomeDashboard 2>/dev/null || true
msg_ok "Stopped Service" msg_ok "Stopped Service"
VENV_PATH="/opt/esphome/.venv" VENV_PATH="/opt/esphome/.venv"
@@ -47,36 +46,33 @@ function update_script() {
$STD uv venv --clear "$VENV_PATH" $STD uv venv --clear "$VENV_PATH"
$STD "$VENV_PATH/bin/python" -m ensurepip --upgrade $STD "$VENV_PATH/bin/python" -m ensurepip --upgrade
$STD "$VENV_PATH/bin/python" -m pip install --upgrade pip $STD "$VENV_PATH/bin/python" -m pip install --upgrade pip
$STD "$VENV_PATH/bin/python" -m pip install esphome esphome-device-builder esptool $STD "$VENV_PATH/bin/python" -m pip install esphome tornado esptool
msg_ok "Migrated to uv/venv" msg_ok "Migrated to uv/venv"
else else
msg_info "Updating ESPHome Device Builder" msg_info "Updating ESPHome"
PYTHON_VERSION="3.12" setup_uv PYTHON_VERSION="3.12" setup_uv
$STD "$VENV_PATH/bin/python" -m pip install --upgrade esphome esphome-device-builder esptool $STD "$VENV_PATH/bin/python" -m pip install --upgrade esphome tornado esptool
msg_ok "Updated ESPHome Device Builder" msg_ok "Updated ESPHome"
fi fi
SERVICE_FILE="/etc/systemd/system/esphomeDashboard.service"
msg_info "Migrating to ESPHome Device Builder service" if ! grep -q "${VENV_PATH}/bin/esphome" "$SERVICE_FILE"; then
if [[ -f /etc/systemd/system/esphomeDashboard.service ]]; then msg_info "Updating systemd service"
systemctl disable -q esphomeDashboard 2>/dev/null || true cat <<EOF >"$SERVICE_FILE"
rm -f /etc/systemd/system/esphomeDashboard.service
fi
cat <<EOF >/etc/systemd/system/esphome-device-builder.service
[Unit] [Unit]
Description=ESPHome Device Builder Description=ESPHome Dashboard
After=network.target After=network.target
[Service] [Service]
ExecStart=${VENV_PATH}/bin/esphome-device-builder /root/config/ ExecStart=${VENV_PATH}/bin/esphome dashboard /root/config/
Restart=always Restart=always
User=root User=root
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOF
$STD systemctl daemon-reload $STD systemctl daemon-reload
$STD systemctl enable esphome-device-builder msg_ok "Updated systemd service"
msg_ok "Migrated to ESPHome Device Builder service" fi
msg_info "Linking esphome to /usr/local/bin" msg_info "Linking esphome to /usr/local/bin"
rm -f /usr/local/bin/esphome rm -f /usr/local/bin/esphome
@@ -84,7 +80,7 @@ EOF
msg_ok "Linked esphome binary" msg_ok "Linked esphome binary"
msg_info "Starting Service" msg_info "Starting Service"
systemctl start esphome-device-builder systemctl start esphomeDashboard
msg_ok "Started Service" msg_ok "Started Service"
msg_ok "Updated successfully!" msg_ok "Updated successfully!"
exit exit
+5 -4
View File
@@ -53,11 +53,12 @@ function update_script() {
cd /opt/invoiceshelf cd /opt/invoiceshelf
$STD composer install --no-dev --optimize-autoloader $STD composer install --no-dev --optimize-autoloader
if command -v corepack >/dev/null 2>&1; then if command -v corepack >/dev/null 2>&1; then
$STD corepack pnpm install
$STD corepack pnpm run build $STD corepack yarn install
$STD corepack yarn build
else else
$STD pnpm install $STD yarn install
$STD pnpm run build $STD yarn build
fi fi
$STD php artisan migrate --force $STD php artisan migrate --force
$STD php artisan optimize:clear $STD php artisan optimize:clear
+14 -3
View File
@@ -29,10 +29,21 @@ function update_script() {
exit exit
fi fi
setup_mariadb setup_mariadb
ensure_dependencies git
if [[ ! -d /opt/librenms/.git ]]; then
msg_info "Initializing LibreNMS git metadata"
LIBRENMS_VERSION=$(cat ~/.librenms 2>/dev/null)
cd /opt/librenms
git init -q
git remote add origin https://github.com/librenms/librenms.git
git fetch --depth 1 origin "refs/tags/v${LIBRENMS_VERSION}" 2>/dev/null ||
git fetch --depth 1 origin "refs/tags/${LIBRENMS_VERSION}" 2>/dev/null || true
git checkout -qf FETCH_HEAD 2>/dev/null || true
chown -R librenms:librenms .git
msg_ok "Initialized LibreNMS git metadata"
fi
msg_info "Updating LibreNMS" msg_info "Updating LibreNMS"
su librenms $STD su - librenms -s /bin/bash -c 'cd /opt/librenms && ./daily.sh'
cd /opt/librenms
./daily.sh
msg_ok "Updated LibreNMS" msg_ok "Updated LibreNMS"
exit exit
} }
-2
View File
@@ -81,8 +81,6 @@ msg_ok "Built Frontend"
msg_info "Setting up Backend" msg_info "Setting up Backend"
cd /opt/endurain/backend cd /opt/endurain/backend
UV_VERSION=$(grep -Po 'required-version\s*=\s*"\K[^"]+' pyproject.toml 2>/dev/null || echo "0.11.18")
UV_VERSION="$UV_VERSION" setup_uv
$STD uv tool install poetry $STD uv tool install poetry
$STD uv tool update-shell $STD uv tool update-shell
export PATH="/root/.local/bin:$PATH" export PATH="/root/.local/bin:$PATH"
+6 -6
View File
@@ -26,8 +26,8 @@ cd /opt/esphome
$STD uv venv --clear /opt/esphome/.venv $STD uv venv --clear /opt/esphome/.venv
$STD /opt/esphome/.venv/bin/python -m ensurepip --upgrade $STD /opt/esphome/.venv/bin/python -m ensurepip --upgrade
$STD /opt/esphome/.venv/bin/python -m pip install --upgrade pip $STD /opt/esphome/.venv/bin/python -m pip install --upgrade pip
$STD /opt/esphome/.venv/bin/python -m pip install esphome esphome-device-builder esptool $STD /opt/esphome/.venv/bin/python -m pip install esphome tornado esptool
msg_ok "Setup and Installed ESPHome Device Builder" msg_ok "Setup and Installed ESPHome"
msg_info "Linking esphome to /usr/local/bin" msg_info "Linking esphome to /usr/local/bin"
rm -f /usr/local/bin/esphome rm -f /usr/local/bin/esphome
@@ -36,13 +36,13 @@ msg_ok "Linked esphome binary"
msg_info "Creating Service" msg_info "Creating Service"
mkdir -p /root/config mkdir -p /root/config
cat <<EOF >/etc/systemd/system/esphome-device-builder.service cat <<EOF >/etc/systemd/system/esphomeDashboard.service
[Unit] [Unit]
Description=ESPHome Device Builder Description=ESPHome Dashboard
After=network.target After=network.target
[Service] [Service]
ExecStart=/opt/esphome/.venv/bin/esphome-device-builder /root/config/ ExecStart=/opt/esphome/.venv/bin/esphome dashboard /root/config/
Restart=always Restart=always
User=root User=root
@@ -50,7 +50,7 @@ User=root
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOF
systemctl enable -q --now esphome-device-builder systemctl enable -q --now esphomeDashboard
msg_ok "Created Service" msg_ok "Created Service"
motd_ssh motd_ssh
+11
View File
@@ -17,6 +17,7 @@ msg_info "Installing Dependencies"
$STD apt install -y \ $STD apt install -y \
acl \ acl \
fping \ fping \
git \
graphviz \ graphviz \
imagemagick \ imagemagick \
mtr-tiny \ mtr-tiny \
@@ -64,6 +65,16 @@ EOF
chown -R librenms:librenms /opt/librenms chown -R librenms:librenms /opt/librenms
chmod 771 /opt/librenms chmod 771 /opt/librenms
chmod -R ug=rwX /opt/librenms/bootstrap/cache /opt/librenms/storage /opt/librenms/logs /opt/librenms/rrd chmod -R ug=rwX /opt/librenms/bootstrap/cache /opt/librenms/storage /opt/librenms/logs /opt/librenms/rrd
if [[ ! -d /opt/librenms/.git ]]; then
LIBRENMS_VERSION=$(cat ~/.librenms 2>/dev/null)
cd /opt/librenms
git init -q
git remote add origin https://github.com/librenms/librenms.git
git fetch --depth 1 origin "refs/tags/v${LIBRENMS_VERSION}" 2>/dev/null ||
git fetch --depth 1 origin "refs/tags/${LIBRENMS_VERSION}" 2>/dev/null || true
git checkout -qf FETCH_HEAD 2>/dev/null || true
chown -R librenms:librenms .git
fi
msg_ok "Configured LibreNMS" msg_ok "Configured LibreNMS"
msg_info "Configure MariaDB" msg_info "Configure MariaDB"
+1 -1
View File
@@ -16,7 +16,7 @@ update_os
msg_info "Getting latest version of VictoriaMetrics" msg_info "Getting latest version of VictoriaMetrics"
victoriametrics_release=$(curl -fsSL "https://api.github.com/repos/VictoriaMetrics/VictoriaMetrics/releases" | victoriametrics_release=$(curl -fsSL "https://api.github.com/repos/VictoriaMetrics/VictoriaMetrics/releases" |
jq -r --arg a "$(arch_resolve)" '.[] | select(.assets[].name | match("^victoria-metrics-linux-" + $a + "-v[0-9.]+.tar.gz$")) | .tag_name' | jq -r --arg a "$arch_resolve" '.[] | select(.assets[].name | match("^victoria-metrics-linux-" + $a + "-v[0-9.]+.tar.gz$")) | .tag_name' |
head -n 1) head -n 1)
victoriametrics_filename="victoria-metrics-linux-$(arch_resolve)-${victoriametrics_release}.tar.gz" victoriametrics_filename="victoria-metrics-linux-$(arch_resolve)-${victoriametrics_release}.tar.gz"
vmutils_filename="vmutils-linux-$(arch_resolve)-${victoriametrics_release}.tar.gz" vmutils_filename="vmutils-linux-$(arch_resolve)-${victoriametrics_release}.tar.gz"
-6
View File
@@ -5722,12 +5722,6 @@ create_lxc_container() {
return 0 return 0
fi fi
local _disable_update="${DISABLE_UPDATE:-no}"
if [[ "${PHS_SILENT:-0}" == "1" || "${_disable_update,,}" == "yes" ]]; then
msg_info "Skipping host LXC stack upgrade prompt (unattended mode)"
return 2
fi
msg_warn "An update for the Proxmox LXC stack is available" msg_warn "An update for the Proxmox LXC stack is available"
echo " pve-container: installed=${_pvec_i:-n/a} candidate=${_pvec_c:-n/a}" echo " pve-container: installed=${_pvec_i:-n/a} candidate=${_pvec_c:-n/a}"
echo " lxc-pve : installed=${_lxcp_i:-n/a} candidate=${_lxcp_c:-n/a}" echo " lxc-pve : installed=${_lxcp_i:-n/a} candidate=${_lxcp_c:-n/a}"
+19 -34
View File
@@ -8452,34 +8452,29 @@ setup_ruby() {
fi fi
# Install ruby-build plugin # Install ruby-build plugin
_install_ruby_build_plugin() { if [[ ! -d "$RBENV_DIR/plugins/ruby-build" ]]; then
local RUBY_BUILD_RELEASE local RUBY_BUILD_RELEASE
RUBY_BUILD_RELEASE=$(get_latest_github_release "rbenv/ruby-build") || { RUBY_BUILD_RELEASE=$(get_latest_github_release "rbenv/ruby-build") || {
msg_error "Failed to fetch latest ruby-build version from GitHub" msg_error "Failed to fetch latest ruby-build version from GitHub"
rm -rf "$TMP_DIR"
return 7 return 7
} }
if ! curl_with_retry "https://github.com/rbenv/ruby-build/archive/refs/tags/v${RUBY_BUILD_RELEASE}.tar.gz" "$TMP_DIR/ruby-build.tar.gz"; then if ! curl_with_retry "https://github.com/rbenv/ruby-build/archive/refs/tags/v${RUBY_BUILD_RELEASE}.tar.gz" "$TMP_DIR/ruby-build.tar.gz"; then
msg_error "Failed to download ruby-build" msg_error "Failed to download ruby-build"
msg_error "Hint: Check connectivity to github.com/rbenv/ruby-build" msg_error "Hint: Check connectivity to github.com/rbenv/ruby-build"
rm -rf "$TMP_DIR"
return 7 return 7
fi fi
tar -xzf "$TMP_DIR/ruby-build.tar.gz" -C "$TMP_DIR" || { tar -xzf "$TMP_DIR/ruby-build.tar.gz" -C "$TMP_DIR" || {
msg_error "Failed to extract ruby-build" msg_error "Failed to extract ruby-build"
rm -rf "$TMP_DIR"
return 251 return 251
} }
mkdir -p "$RBENV_DIR/plugins/ruby-build" mkdir -p "$RBENV_DIR/plugins/ruby-build"
cp -r "$TMP_DIR/ruby-build-${RUBY_BUILD_RELEASE}/." "$RBENV_DIR/plugins/ruby-build/" cp -r "$TMP_DIR/ruby-build-${RUBY_BUILD_RELEASE}/." "$RBENV_DIR/plugins/ruby-build/"
return 0
}
if [[ ! -d "$RBENV_DIR/plugins/ruby-build" ]]; then
_install_ruby_build_plugin || {
rm -rf "$TMP_DIR"
return 7
}
fi fi
# Setup PATH and install Ruby version # Setup PATH and install Ruby version
@@ -8487,14 +8482,6 @@ setup_ruby() {
eval "$("$RBENV_BIN" init - bash)" 2>/dev/null || true eval "$("$RBENV_BIN" init - bash)" 2>/dev/null || true
if ! "$RBENV_BIN" versions --bare 2>/dev/null | grep -qx "$RUBY_VERSION"; then if ! "$RBENV_BIN" versions --bare 2>/dev/null | grep -qx "$RUBY_VERSION"; then
if [[ ! -f "$RBENV_DIR/plugins/ruby-build/share/ruby-build/$RUBY_VERSION" ]]; then
msg_info "Updating ruby-build definitions"
_install_ruby_build_plugin || {
rm -rf "$TMP_DIR"
return 7
}
msg_ok "Updated ruby-build definitions"
fi
$STD "$RBENV_BIN" install "$RUBY_VERSION" || { $STD "$RBENV_BIN" install "$RUBY_VERSION" || {
msg_error "Failed to install Ruby $RUBY_VERSION" msg_error "Failed to install Ruby $RUBY_VERSION"
rm -rf "$TMP_DIR" rm -rf "$TMP_DIR"
@@ -8723,14 +8710,12 @@ setup_uv() {
ensure_dependencies jq ensure_dependencies jq
# Fetch target version (pinned via UV_VERSION or latest release) # Fetch latest version
local TARGET_VERSION="${UV_VERSION:-}" local LATEST_VERSION
if [[ -z "$TARGET_VERSION" ]]; then LATEST_VERSION=$(get_latest_github_release "astral-sh/uv") || {
TARGET_VERSION=$(get_latest_github_release "astral-sh/uv") || { msg_error "Could not fetch latest uv version from GitHub API"
msg_error "Could not fetch latest uv version from GitHub API" return 7
return 7 }
}
fi
# Get currently installed version # Get currently installed version
local INSTALLED_VERSION="" local INSTALLED_VERSION=""
@@ -8738,9 +8723,9 @@ setup_uv() {
INSTALLED_VERSION=$("$UV_BIN" --version 2>/dev/null | awk '{print $2}') INSTALLED_VERSION=$("$UV_BIN" --version 2>/dev/null | awk '{print $2}')
fi fi
# Scenario 1: Already at target version # Scenario 1: Already at latest version
if [[ -n "$INSTALLED_VERSION" && "$INSTALLED_VERSION" == "$TARGET_VERSION" ]]; then if [[ -n "$INSTALLED_VERSION" && "$INSTALLED_VERSION" == "$LATEST_VERSION" ]]; then
cache_installed_version "uv" "$TARGET_VERSION" cache_installed_version "uv" "$LATEST_VERSION"
# Check if uvx is needed and missing # Check if uvx is needed and missing
if [[ "${USE_UVX:-NO}" == "YES" ]] && [[ ! -x "$UVX_BIN" ]]; then if [[ "${USE_UVX:-NO}" == "YES" ]] && [[ ! -x "$UVX_BIN" ]]; then
@@ -8753,13 +8738,13 @@ setup_uv() {
fi fi
# Scenario 2: New install or upgrade # Scenario 2: New install or upgrade
if [[ -n "$INSTALLED_VERSION" && "$INSTALLED_VERSION" != "$TARGET_VERSION" ]]; then if [[ -n "$INSTALLED_VERSION" && "$INSTALLED_VERSION" != "$LATEST_VERSION" ]]; then
msg_info "Upgrade uv from $INSTALLED_VERSION to $TARGET_VERSION" msg_info "Upgrade uv from $INSTALLED_VERSION to $LATEST_VERSION"
else else
msg_info "Setup uv $TARGET_VERSION" msg_info "Setup uv $LATEST_VERSION"
fi fi
local UV_URL="https://github.com/astral-sh/uv/releases/download/${TARGET_VERSION}/${UV_TAR}" local UV_URL="https://github.com/astral-sh/uv/releases/download/${LATEST_VERSION}/${UV_TAR}"
if ! curl_with_retry "$UV_URL" "$TMP_DIR/uv.tar.gz"; then if ! curl_with_retry "$UV_URL" "$TMP_DIR/uv.tar.gz"; then
msg_error "Failed to download uv from $UV_URL" msg_error "Failed to download uv from $UV_URL"
@@ -8814,8 +8799,8 @@ setup_uv() {
msg_ok "Python $PYTHON_VERSION installed" msg_ok "Python $PYTHON_VERSION installed"
fi fi
cache_installed_version "uv" "$TARGET_VERSION" cache_installed_version "uv" "$LATEST_VERSION"
msg_ok "Setup uv $TARGET_VERSION" msg_ok "Setup uv $LATEST_VERSION"
} }
# Helper function to install uvx wrapper # Helper function to install uvx wrapper
+16 -49
View File
@@ -145,35 +145,11 @@ function header_info {
EOF EOF
} }
function sanitize_service_name() {
local name="${1//$'\r'/}"
name="${name//$'\n'/}"
[[ -z "$name" ]] && return 1
[[ "$name" == *'#!'* ]] && return 1
[[ ! "$name" =~ ^[a-zA-Z0-9._-]+$ ]] && return 1
return 0
}
function validate_service_script() {
local name="$1"
sanitize_service_name "$name" || return 1
curl -fsSL --max-time 10 -o /dev/null \
"https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/${name}.sh" 2>/dev/null
}
function detect_service() { function detect_service() {
local container="$1" pushd $(mktemp -d) >/dev/null
local tmpdir update_file pct pull "$1" /usr/bin/update update 2>/dev/null
service="" service=$(cat update | sed 's|.*/ct/||g' | sed 's|\.sh).*||g')
tmpdir=$(mktemp -d) popd >/dev/null
update_file="$tmpdir/update"
pct pull "$container" /usr/bin/update "$update_file" 2>/dev/null || true
if [[ ! -s "$update_file" ]]; then
rm -rf "$tmpdir"
return 1
fi
service=$(grep -oE '/ct/[a-zA-Z0-9._-]+\.sh' "$update_file" 2>/dev/null | head -n1 | sed 's|.*/ct/||; s|\.sh$||')
rm -rf "$tmpdir"
} }
function dry_run_container() { function dry_run_container() {
@@ -471,33 +447,24 @@ for container in $CHOICE; do
#1) Detect service using the service name in the update command #1) Detect service using the service name in the update command
detect_service $container detect_service $container
#1.1) If update script not detected or service name is invalid, skip #1.1) If update script not detected, return
if [ -z "${service}" ] || ! sanitize_service_name "${service}"; then if [ -z "${service}" ]; then
echo -e "${RD}[ERROR]${CL} Could not detect a valid service name for container $container" echo -e "${YW}[WARN]${CL} Update script not found. Skipping to next container"
log_result "$container" "(unknown)" "ERROR" "Invalid or missing service name in /usr/bin/update" log_result "$container" "(unknown)" "SKIPPED" "No update script found in container"
log_write "Container $container: ERROR — invalid or missing service name" log_write "Container $container: SKIPPED — no update script found"
continue continue
else
echo -e "${BL}[INFO]${CL} Detected service: ${GN}${service}${CL}"
log_write "Container $container: detected service '$service'"
fi fi
if ! validate_service_script "${service}"; then
echo -e "${RD}[ERROR]${CL} Service '${service}' does not resolve to ct/${service}.sh"
log_result "$container" "${service}" "ERROR" "No matching ct/${service}.sh script found"
log_write "Container $container: ERROR — ct/${service}.sh not found"
continue
fi
echo -e "${BL}[INFO]${CL} Detected service: ${GN}${service}${CL}"
log_write "Container $container: detected service '${service}'"
#2) Extract service build/update resource requirements from config/installation file #2) Extract service build/update resource requirements from config/installation file
script=$(curl -fsSL "https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/${service}.sh") script=$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/${service}.sh)
#2.1) Check if the script downloaded successfully #2.1) Check if the script downloaded successfully
if [ $? -ne 0 ] || [ -z "${script}" ]; then if [ $? -ne 0 ]; then
echo -e "${RD}[ERROR]${CL} Failed to download ct/${service}.sh" echo -e "${RD}[ERROR]${CL} Issue while downloading install script."
log_result "$container" "${service}" "ERROR" "Failed to download ct/${service}.sh" echo -e "${YW}[WARN]${CL} Unable to assess build resource requirements. Proceeding with current resources."
log_write "Container $container (${service}): ERROR — failed to download install script"
continue
fi fi
config=$(pct config "$container") config=$(pct config "$container")