Skip to content

Commit

Permalink
Merge pull request #96 from flatcar/ader1990/fix-mksquashfs-version-c…
Browse files Browse the repository at this point in the history
…heck

bake: fix mksquashfs version check
  • Loading branch information
ader1990 authored Oct 11, 2024
2 parents 1505915 + 1903f30 commit b7aaad4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions bake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -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 ] && [ "${VERMIN}" -gt 6 ]; 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[@]}"
Expand Down

0 comments on commit b7aaad4

Please sign in to comment.