From 0a257fda5e14b5a5719478568a426cf4b27fa405 Mon Sep 17 00:00:00 2001 From: Igor Pecovnik Date: Wed, 11 Dec 2024 18:11:31 +0100 Subject: [PATCH] Compare needs to be quoted else it throws error on empty --- tools/json/config.system.json | 2 +- tools/modules/functions/set_runtime_variables.sh | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/json/config.system.json b/tools/json/config.system.json index 134288903..6be7d4535 100644 --- a/tools/json/config.system.json +++ b/tools/json/config.system.json @@ -94,7 +94,7 @@ ], "status": "Stable", "author": "@armbian", - "condition": "! module_zfs status && linux-version compare ${KERNELID} le $(module_zfs kernel_max)" + "condition": "! module_zfs status && linux-version compare \"${KERNELID}\" le \"$(module_zfs kernel_max)\"" }, { "id": "SY221", diff --git a/tools/modules/functions/set_runtime_variables.sh b/tools/modules/functions/set_runtime_variables.sh index 87ca3d26e..96dcab053 100644 --- a/tools/modules/functions/set_runtime_variables.sh +++ b/tools/modules/functions/set_runtime_variables.sh @@ -66,8 +66,13 @@ function set_runtime_variables() { [[ -z "${DEFAULT_ADAPTER// /}" ]] && DEFAULT_ADAPTER="lo" # zfs subsystem - determine if our kernel is not too recent ZFS_DKMS_VERSION=$(LC_ALL=C apt-cache policy zfs-dkms | grep Candidate | xargs | cut -d" " -f2 | cut -c-5) - ZFS_KERNEL_MAX=$(wget -qO- https://github.com/openzfs/zfs/raw/refs/tags/zfs-${ZFS_DKMS_VERSION}/META | grep Maximum | cut -d" " -f2) - + ZFS_KERNEL_MAX=$(wget -qO- https://raw.githubusercontent.com/openzfs/zfs/refs/tags/zfs-${ZFS_DKMS_VERSION}/META | grep Maximum | cut -d" " -f2) + # sometimes Ubuntu sets higher version then existing tag. Lets probe previous version + if [[ -z "${ZFS_KERNEL_MAX}" ]]; then + local previous_version="$(printf "%03d" "$(expr "$(echo $ZFS_DKMS_VERSION | sed 's/\.//g')" - 1)")" + local previous_version=$(echo "${previous_version:0:1}.${previous_version:1:1}.${previous_version:2:1}") + ZFS_KERNEL_MAX=$(wget -qO- https://raw.githubusercontent.com/openzfs/zfs/refs/tags/zfs-${previous_version}/META | grep Maximum | cut -d" " -f2) + fi # detect desktop check_desktop