From: Benjamin Drung Date: Sat, 7 Feb 2026 21:58:04 +0000 (+0100) Subject: test: do not require pkg-config X-Git-Tag: 110~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=50c2c0e52aa1d502a4ecc556bd0a1ff53157e176;p=thirdparty%2Fdracut-ng.git test: do not require pkg-config The command `pkg-config` might not be installed in the test environment (for example on Debian autopkgest). Replace calling `pkg-config` by calling `systemctl --version`. --- diff --git a/test/TEST-40-SYSTEMD/test.sh b/test/TEST-40-SYSTEMD/test.sh index 053ac8bdc..2c1544a2b 100755 --- a/test/TEST-40-SYSTEMD/test.sh +++ b/test/TEST-40-SYSTEMD/test.sh @@ -20,6 +20,14 @@ test_run() { check_qemu_log } +is_systemd_version_greater_or_equal() { + local version="$1" + + command -v systemctl &> /dev/null + systemd_version=$(systemctl --version | awk 'NR==1 { print $2 }') + ((systemd_version >= "$version")) +} + test_setup() { build_client_rootfs "$TESTDIR/rootfs" build_ext4_image "$TESTDIR/rootfs" "$TESTDIR"/root.img ' rdinit=/bin/sh' @@ -39,7 +47,7 @@ test_setup() { # shellcheck disable=SC2144 # We're not installing multilib libfido2, so # glob will only match once. More matches would break the test anyway. - if pkg-config --exists "libsystemd >= 257" && [ -e /usr/lib*/libfido2.so.1 ] \ + if is_systemd_version_greater_or_equal 257 && [ -e /usr/lib*/libfido2.so.1 ] \ && ! lsinitrd "$TESTDIR"/initramfs.testing | grep -E ' usr/lib[^/]*/libfido2\.so\.1\b' > /dev/null; then echo "Error: libfido2.so.1 should have been included in the initramfs" >&2 return 1