From 16dce6c88541031c8434cb0199558fcc417b3d51 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 13428890..6be7d453 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 87ca3d26..287a7486 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 newversion="$(printf "%03d" "$(expr "$(echo $ZFS_DKMS_VERSION | sed 's/\.//g')" - 1)")" + local zfs_dkms_version=$(echo "${newversion:1:1}.${newversion:2:1}.${newversion:2:3}") + ZFS_KERNEL_MAX=$(wget -qO- https://raw.githubusercontent.com/openzfs/zfs/refs/tags/zfs-${zfs_dkms_version}/META | grep Maximum | cut -d" " -f2) + fi # detect desktop check_desktop