From ac3326dfb82b7070fd0c8687ab05d8f049cd89b9 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sun, 29 Jan 2023 17:05:04 +0100 Subject: [PATCH 1/5] mkosi: Fix shellcheck warnings --- mkosi.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mkosi.build b/mkosi.build index d2b9ea957e..b67ee62e22 100755 --- a/mkosi.build +++ b/mkosi.build @@ -235,7 +235,7 @@ if [ -n "$CI_BUILD" ]; then fi if [ -n "$SANITIZERS" ]; then - LD_PRELOAD=$(ldd $BUILDDIR/systemd | grep libasan.so | awk '{print $3}') + LD_PRELOAD=$(ldd "$BUILDDIR"/systemd | grep libasan.so | awk '{print $3}') mkdir -p "$DESTDIR/etc/systemd/system.conf.d" @@ -292,7 +292,7 @@ if [ -d mkosi.kernel/ ]; then make O="$BUILDDIR/mkosi.kernel" -j "$(nproc)" - KERNEL_RELEASE="$(make O=$BUILDDIR/mkosi.kernel -s kernelrelease)" + KERNEL_RELEASE=$(make O="$BUILDDIR"/mkosi.kernel -s kernelrelease) mkdir -p "$DESTDIR/usr/lib/modules/$KERNEL_RELEASE" make O="$BUILDDIR/mkosi.kernel" INSTALL_HDR_PATH=/usr headers_install make O="$BUILDDIR/mkosi.kernel" INSTALL_MOD_PATH="$DESTDIR/usr" modules_install From 84a4af2c81c555a60127ef05a9c0b4762c5d9418 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sun, 29 Jan 2023 15:04:13 +0100 Subject: [PATCH 2/5] mkosi: Don't modify rootfs in build script When unprivileged mkosi becomes available, builds will be executed as an unprivileged user, so we won't be able to modify the rootfs anymore. Let's update the build script to account for this. --- mkosi.build | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/mkosi.build b/mkosi.build index b67ee62e22..ecd233ed5b 100755 --- a/mkosi.build +++ b/mkosi.build @@ -22,7 +22,11 @@ fi # If mkosi.builddir/ exists mkosi will set $BUILDDIR to it, let's then use it # as out-of-tree build dir. Otherwise, let's make up our own builddir. -[ -z "$BUILDDIR" ] && BUILDDIR=build +[ -z "$BUILDDIR" ] && BUILDDIR="$PWD"/build + +# Let's make sure we're using stuff from the build directory first if available there. +PATH="$BUILDDIR:$PATH" +export PATH # Meson uses Python 3 and requires a locale with an UTF-8 character map. # Not running under UTF-8 makes the `ninja test` step break with a CodecError. @@ -52,7 +56,7 @@ fi # the ubuntu script with a symlink to the first bpftool program we can find. for bpftool in /usr/lib/linux-tools/*/bpftool; do [ -x "$bpftool" ] || continue - ln -sf "$bpftool" /usr/sbin/bpftool + ln -sf "$bpftool" "$BUILDDIR"/bpftool break done @@ -60,16 +64,15 @@ done # 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 <"$BUILDDIR"/bpftool < Date: Sun, 29 Jan 2023 15:07:38 +0100 Subject: [PATCH 3/5] mkosi: Drop focal workaround in build script Now that jammy is the latest LTS, lets drop the focal workaround from the build script. --- mkosi.build | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/mkosi.build b/mkosi.build index ecd233ed5b..b058b0352f 100755 --- a/mkosi.build +++ b/mkosi.build @@ -191,12 +191,7 @@ if [ "$WITH_TESTS" = 1 ] ; then fi cd "$SRCDIR" -# Ubuntu Focal is stuck with meson 0.53.0. -if [ "$(meson -v | cut -d . -f 2)" -gt 53 ] ; then - meson install -C "$BUILDDIR" --quiet --no-rebuild --only-changed -else - meson install -C "$BUILDDIR" --no-rebuild --only-changed -fi +meson install -C "$BUILDDIR" --quiet --no-rebuild --only-changed mkdir -p "$DESTDIR"/etc From 868c318ba3657b4d77ce08241f568694288b6f99 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sun, 29 Jan 2023 15:17:06 +0100 Subject: [PATCH 4/5] mkosi: Add back CentOS Stream 8 to CI It's still useful to test the EFI handover logic in systemd-boot. We use a mkosi.prepare script to install a newer python and update the system to use it. --- .github/workflows/mkosi.yml | 4 +++- mkosi.prepare | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100755 mkosi.prepare diff --git a/.github/workflows/mkosi.yml b/.github/workflows/mkosi.yml index 4b77be24b4..86321c0623 100644 --- a/.github/workflows/mkosi.yml +++ b/.github/workflows/mkosi.yml @@ -74,10 +74,12 @@ jobs: release: tumbleweed - distro: centos release: "9" + - distro: centos + release: "8" steps: - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - - uses: systemd/mkosi@37c0524360ee460174f83081fa14e0dc9bc6ee0d + - uses: systemd/mkosi@f36983f552a197faf9e36361cc68a297e68bee73 - name: Configure run: | diff --git a/mkosi.prepare b/mkosi.prepare new file mode 100755 index 0000000000..9d377cf716 --- /dev/null +++ b/mkosi.prepare @@ -0,0 +1,19 @@ +#!/bin/sh +# SPDX-License-Identifier: LGPL-2.1-or-later +set -e + +if [ "$(grep '^ID=' /etc/os-release)" = "ID=\"centos\"" ] && [ "$(grep '^VERSION=' /etc/os-release)" = "VERSION=\"8\"" ]; then + # python39-pluggy is a pytest dependency that's not installed for some reason. + dnf \ + -y \ + --enablerepo=powertools \ + --setopt=powertools.module_hotfixes=true \ + install \ + python39 \ + python39-pefile \ + python39-jinja2 \ + python39-pytest \ + python39-pluggy + alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 + alternatives --set python3 /usr/bin/python3.9 +fi From 3d4fa9aaa0383094c178bb5dc228f93629511e61 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sun, 29 Jan 2023 17:34:21 +0100 Subject: [PATCH 5/5] mkosi: Disable auditd when running with nspawn in CI auditd fails to start in CentOS Stream 9 causing CI failures so let's disable it when running with nspawn in CI. --- .github/workflows/mkosi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mkosi.yml b/.github/workflows/mkosi.yml index 86321c0623..b97ce6eee5 100644 --- a/.github/workflows/mkosi.yml +++ b/.github/workflows/mkosi.yml @@ -102,7 +102,7 @@ jobs: run: sudo mkosi summary - name: Boot ${{ matrix.distro }} systemd-nspawn - run: sudo mkosi boot ${{ env.KERNEL_CMDLINE }} + run: sudo mkosi boot ${{ env.KERNEL_CMDLINE }} audit=0 - name: Check ${{ matrix.distro }} systemd-nspawn run: sudo mkosi shell bash -c "[[ -e /testok ]] || { cat /failed-services; exit 1; }"