]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mkosi: Make sure bpf-framework works on CentOS Stream 8 as well
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 14 Oct 2022 12:53:41 +0000 (14:53 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 17 Oct 2022 06:45:48 +0000 (08:45 +0200)
mkosi.build

index 7a32673bb48c06a3c7f8aa635a276abf0ed17e5e..f02a15ad4d21a7e1f1ca076d739dc9e8687b00b1 100755 (executable)
@@ -56,6 +56,22 @@ for bpftool in /usr/lib/linux-tools/*/bpftool; do
         break
 done
 
+# CentOS Stream 8 includes bpftool 4.18.0 which is lower than what we need. However, they've backported the
+# specific feature we need ("gen skeleton") to this version, so we replace bpftool with a script that reports
+# version 5.6.0 to satisfy meson which makes bpf work on CentOS Stream 8 as well.
+if [ "$(grep '^ID=' /etc/os-release)" = "ID=\"centos\"" ] && [ "$(grep '^VERSION=' /etc/os-release)" = "VERSION=\"8\"" ]; then
+        cp /usr/sbin/bpftool /usr/sbin/bpftool.real
+        cat > /usr/sbin/bpftool <<EOF
+#!/bin/sh
+if [ "\$1" = --version ]; then
+        echo 5.6.0
+else
+        exec /usr/sbin/bpftool.real \$@
+fi
+EOF
+        chmod +x /usr/sbin/bpftool
+fi
+
 if [ ! -f "$BUILDDIR"/build.ninja ] ; then
         sysvinit_path=$(realpath /etc/init.d)