Compare commits

..

1 Commits

Author SHA1 Message Date
MickLesk
0686beba73 fix(tools.func): use dpkg-query for reliable JDK version detection
Replace dpkg -l with dpkg-query -W for Temurin JDK version detection
in setup_java(). dpkg -l truncates long package names in its formatted
table output, causing version extraction to fail. This triggered an
unnecessary remove+reinstall cycle on every update even when the
correct version was already installed.

The unnecessary reinstall caused ~110MB re-downloads and filesystem
block changes that inflated PBS incremental backups.

Fixes #13099
2026-03-19 20:02:08 +01:00

View File

@@ -282,7 +282,7 @@ get_cached_version() {
cat "/var/cache/app-versions/${app}_version.txt"
return 0
fi
return 1
return 0
}
# ------------------------------------------------------------------------------
@@ -1100,9 +1100,8 @@ get_system_arch() {
# ------------------------------------------------------------------------------
create_temp_dir() {
local tmp_dir=$(mktemp -d)
# Callers should handle their own cleanup (rm -rf "$tmpdir")
# Do NOT set trap here — it would overwrite global traps and only fire
# when create_temp_dir() itself returns, not the calling function
# Set trap to cleanup on EXIT, ERR, INT, TERM
trap "rm -rf '$tmp_dir'" EXIT ERR INT TERM
echo "$tmp_dir"
}
@@ -5352,7 +5351,7 @@ function setup_java() {
"main"
fi
# Get currently installed version (use dpkg-query to avoid column truncation)
# Get currently installed version
local INSTALLED_VERSION=""
INSTALLED_VERSION=$(dpkg-query -W -f '${Package}\n' 2>/dev/null | grep -oP '^temurin-\K[0-9]+(?=-jdk$)' | head -n1 || echo "")
@@ -7833,8 +7832,8 @@ function setup_uv() {
local TMP_DIR=$(mktemp -d)
local CACHED_VERSION
# trap for TMP Cleanup (RETURN instead of EXIT to avoid overwriting global traps)
trap "rm -rf '$TMP_DIR'" RETURN
# trap for TMP Cleanup
trap "rm -rf '$TMP_DIR'" EXIT
CACHED_VERSION=$(get_cached_version "uv")
@@ -8104,8 +8103,6 @@ function setup_docker() {
local docker_installed=false
local portainer_installed=false
local USE_DOCKER_REPO="${USE_DOCKER_REPO:-false}"
local DOCKER_CURRENT_VERSION=""
local DOCKER_LATEST_VERSION=""
# Check if Docker is already installed
if command -v docker &>/dev/null; then