systemd: fix build platform shebang reference

patchShebangs was writing a build platform bash shebang to
systemd-update-helper, which ends up in the output. To fix this, this patch
restricts patchShebangs to only run on certain directories.

Also, remove a comment stating that patchShebangs will no longer be necessary
after the next systemd release. This is not the case because /usr/bin/env
doesn't exist within the sandbox and will still need to be patched.
This commit is contained in:
Ben Wolsieffer 2022-05-21 16:03:56 -04:00
parent 2ab0d35250
commit 5e2009d894

View file

@ -340,11 +340,12 @@ stdenv.mkDerivation {
exit 1
fi
''
# Finally patch shebangs that might need patching.
# Should no longer be necessary with v251.
# https://github.com/systemd/systemd/pull/21749
# Finally, patch shebangs in scripts used at build time. This must not patch
# scripts that will end up in the output, to avoid build platform references
# when cross-compiling.
+ ''
patchShebangs .
shopt -s extglob
patchShebangs tools test src/!(rpm)
'';
outputs = [ "out" "man" "dev" ];
@ -603,11 +604,6 @@ stdenv.mkDerivation {
${lib.concatStringsSep "\n" (lib.flatten (map mkSubstitute binaryReplacements))}
${lib.concatMapStringsSep "\n" mkEnsureSubstituted binaryReplacements}
for dir in tools src/resolve test src/test src/shared; do
patchShebangs $dir
done
substituteInPlace src/libsystemd/sd-journal/catalog.c \
--replace /usr/lib/systemd/catalog/ $out/lib/systemd/catalog/
'';