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
3 changed files with 6 additions and 24 deletions

View File

@@ -23,18 +23,17 @@ function update_script() {
header_info
check_container_storage
check_container_resources
#RELEASE="0.301.1"
RELEASE="0.301.1"
if [[ ! -f /etc/systemd/system/nocodb.service ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
#if check_for_gh_release "nocodb" "nocodb/nocodb" "${RELEASE}"; then
if check_for_gh_release "nocodb" "nocodb/nocodb"; then
if check_for_gh_release "nocodb" "nocodb/nocodb" "${RELEASE}"; then
msg_info "Stopping Service"
systemctl stop nocodb
msg_ok "Stopped Service"
fetch_and_deploy_gh_release "nocodb" "nocodb/nocodb" "singlefile" "latest" "/opt/nocodb/" "Noco-linux-x64"
fetch_and_deploy_gh_release "nocodb" "nocodb/nocodb" "singlefile" "${RELEASE}" "/opt/nocodb/" "Noco-linux-x64"
msg_info "Starting Service"
systemctl start nocodb

View File

@@ -13,11 +13,11 @@ setting_up_container
network_check
update_os
fetch_and_deploy_gh_release "nocodb" "nocodb/nocodb" "singlefile" "latest" "/opt/nocodb/" "Noco-linux-x64"
fetch_and_deploy_gh_release "nocodb" "nocodb/nocodb" "singlefile" "0.301.1" "/opt/nocodb/" "Noco-linux-x64"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/nocodb.service
[Unit]
echo "[Unit]
Description=nocodb
[Service]

View File

@@ -5353,24 +5353,7 @@ function setup_java() {
# Get currently installed version
local INSTALLED_VERSION=""
if dpkg -l | grep -q "temurin-.*-jdk" 2>/dev/null; then
INSTALLED_VERSION=$(dpkg -l 2>/dev/null | awk '/temurin-.*-jdk/{print $2}' | grep -oP 'temurin-\K[0-9]+' | head -n1 || echo "")
fi
# Validate INSTALLED_VERSION is not empty if JDK package found
local JDK_COUNT=0
JDK_COUNT=$(dpkg -l 2>/dev/null | grep -c "temurin-.*-jdk" || true)
if [[ -z "$INSTALLED_VERSION" && "${JDK_COUNT:-0}" -gt 0 ]]; then
msg_warn "Found Temurin JDK but cannot determine version - attempting reinstall"
# Try to get actual package name for purge
local OLD_PACKAGE
OLD_PACKAGE=$(dpkg -l 2>/dev/null | awk '/temurin-.*-jdk/{print $2}' | head -n1 || echo "")
if [[ -n "$OLD_PACKAGE" ]]; then
msg_info "Removing existing package: $OLD_PACKAGE"
$STD apt purge -y "$OLD_PACKAGE" || true
fi
INSTALLED_VERSION="" # Reset to trigger fresh install
fi
INSTALLED_VERSION=$(dpkg-query -W -f '${Package}\n' 2>/dev/null | grep -oP '^temurin-\K[0-9]+(?=-jdk$)' | head -n1 || echo "")
# Scenario 1: Already at correct version
if [[ "$INSTALLED_VERSION" == "$JAVA_VERSION" ]]; then