From b782f7b9684c9f0a13e0b8a2ff37af0ec4cbcbaa Mon Sep 17 00:00:00 2001 From: Adrian Vladu Date: Thu, 10 Oct 2024 13:40:31 +0300 Subject: [PATCH 1/2] bake: fix mksquashfs version check The mksquashfs version that supports the xattrs-exclude flag is 4.6.1, but the logic excluded the version because of a strict (greater than) comparison. See: https://github.com/flatcar/sysext-bakery/pull/60/commits/d1419fc1254f9723a3614811bdd29f9d6a3bba9d --- bake.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bake.sh b/bake.sh index 0513df3..7041ca9 100755 --- a/bake.sh +++ b/bake.sh @@ -67,7 +67,7 @@ else VERMAJ=$(echo "${VER}" | cut -d . -f 1) VERMIN=$(echo "${VER}" | cut -d . -f 2) ARG=(-all-root -noappend) - if [ "${VERMAJ}" -gt 4 ] && [ "${VERMIN}" -gt 6 ]; then + if [[ "${VERMAJ}" -gt 4 || ( "${VERMAJ}" -eq 4 && "${VERMIN}" -gt 5 ) ]]; then ARG+=('-xattrs-exclude' '^btrfs.') fi mksquashfs "${SYSEXTNAME}" "${SYSEXTNAME}".raw "${ARG[@]}" From 1903f309170796f3452be2703251236c3f7cfd41 Mon Sep 17 00:00:00 2001 From: Adrian Vladu Date: Fri, 11 Oct 2024 14:07:42 +0300 Subject: [PATCH 2/2] bake: use semver for version check --- bake.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bake.sh b/bake.sh index 7041ca9..2a71e88 100755 --- a/bake.sh +++ b/bake.sh @@ -38,6 +38,10 @@ elif [ "${ARCH}" = "aarch64" ]; then ARCH="arm64" fi +function version_ge() { + test "$(printf '%s\n' "$@" | sort -rV | head -n 1)" == "$1"; +} + mkdir -p "${SYSEXTNAME}/usr/lib/extension-release.d" { echo "ID=${OS}" @@ -64,10 +68,9 @@ elif [ "${FORMAT}" = "ext4" ] || [ "${FORMAT}" = "ext2" ]; then resize2fs -M "${SYSEXTNAME}".raw else VER=$({ mksquashfs -version || true ; } | head -n1 | cut -d " " -f 3) - VERMAJ=$(echo "${VER}" | cut -d . -f 1) - VERMIN=$(echo "${VER}" | cut -d . -f 2) ARG=(-all-root -noappend) - if [[ "${VERMAJ}" -gt 4 || ( "${VERMAJ}" -eq 4 && "${VERMIN}" -gt 5 ) ]]; then + # use sort semver to check if current version is >= 4.6.1 + if version_ge "$VER" "4.6.1"; then ARG+=('-xattrs-exclude' '^btrfs.') fi mksquashfs "${SYSEXTNAME}" "${SYSEXTNAME}".raw "${ARG[@]}"