]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mkosi: Use symlinks instead of bind mounts for Arch
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 28 Apr 2024 17:09:44 +0000 (19:09 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 30 Apr 2024 15:01:41 +0000 (17:01 +0200)
With bind mounts, the directories we bind mount to get recorded as
the meson source and build directories. This means meson will complain
if we later try to run meson install -C /work/build in the virtual
machine or container. If we use symlinks, the directories we symlink to
will be recorded as the meson source and build directories, which means
meson install -C /work/build will work when executed after booting the
VM or container.

I tried to do the same for debian as well but the debian package tooling
changes directory into the build directory and then does meson setup ..
which is completely broken when switching to a symlink.

mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot

index 04eeaf1e37c406a7c7e2014d3a80adf047d6fad9..33a64cb1d55e11290846176908856651f17db7f1 100755 (executable)
@@ -10,12 +10,12 @@ if [ ! -f "pkg/$ID/PKGBUILD" ]; then
     exit 1
 fi
 
-# We can't configure the source or build directory so we use bind mounts instead to make sure they are in the
+# We can't configure the source or build directory so we use symlinks instead to make sure they are in the
 # expected locations.
-mount --mkdir --bind "$SRCDIR" "pkg/$ID/systemd-stable/"
-mount --mkdir --bind "$BUILDDIR" "pkg/$ID/build/"
+ln --symbolic "$SRCDIR" "pkg/$ID/systemd-stable"
+ln --symbolic "$BUILDDIR" "pkg/$ID/build"
 # Because we run with --noextract we are responsible for making sure the source files appear in src/.
-mount --mkdir --rbind "$PWD/pkg/$ID" "pkg/$ID/src/"
+ln --symbolic . "pkg/$ID/src"
 
 # shellcheck source=/dev/null
 . /etc/makepkg.conf