diff options
author | Daan De Meyer <daan.j.demeyer@gmail.com> | 2023-01-29 15:04:13 +0100 |
---|---|---|
committer | Daan De Meyer <daan.j.demeyer@gmail.com> | 2023-01-29 17:05:23 +0100 |
commit | 84a4af2c81c555a60127ef05a9c0b4762c5d9418 (patch) | |
tree | e1efc984c3ec2fe34f414e5620ea50e8777f296d /mkosi.build | |
parent | ac3326dfb82b7070fd0c8687ab05d8f049cd89b9 (diff) | |
download | systemd-84a4af2c81c555a60127ef05a9c0b4762c5d9418.tar.gz |
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.
Diffstat (limited to 'mkosi.build')
-rwxr-xr-x | mkosi.build | 15 |
1 files 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 <<EOF + cat >"$BUILDDIR"/bpftool <<EOF #!/bin/sh if [ "\$1" = --version ]; then echo 5.6.0 else - exec /usr/sbin/bpftool.real \$@ + exec /usr/sbin/bpftool \$@ fi EOF - chmod +x /usr/sbin/bpftool + chmod +x "$BUILDDIR"/bpftool fi if [ ! -f "$BUILDDIR"/build.ninja ] ; then |