about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2024-01-28 11:54:26 +0100
committerAlyssa Ross <hi@alyssa.is>2024-01-28 11:57:30 +0100
commita136def4f7256146b32e3625e53dcdf7464165f9 (patch)
treee8dfceae9cf33911eefa237d6d328b057fbe3284
parent9a9ed628da061820b9039a6795cb233f08816c76 (diff)
compressFirmwareXz: fix symlink type check
The previous version didn't work in the case of relative symlinks in
subdirectories.  If "foo/bar" was a link to "baz", it would check for
a link to "baz" in the root, rather than under "foo".

We don't need to dereference the symlink ourselves for [ anyway, as it
dereferences its arguments itself, so all we need to do to fix this is
to pass it the link.

Fixes: 14f83d5c6f98 ("compressFirmwareXz: fix links to directories")
-rw-r--r--pkgs/build-support/kernel/compress-firmware-xz.nix2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkgs/build-support/kernel/compress-firmware-xz.nix b/pkgs/build-support/kernel/compress-firmware-xz.nix
index a69b31bb3bd04..437c89afe184b 100644
--- a/pkgs/build-support/kernel/compress-firmware-xz.nix
+++ b/pkgs/build-support/kernel/compress-firmware-xz.nix
@@ -15,7 +15,7 @@ runCommand "${firmware.name}-xz" args ''
           sh -c 'xz -9c -T1 -C crc32 --lzma2=dict=2MiB "${firmware}/$1" > "$1.xz"' --)
   (cd ${firmware} && find lib/firmware -type l) | while read link; do
       target="$(readlink "${firmware}/$link")"
-      if [ -f $target ]; then
+      if [ -f "${firmware}/$link" ]; then
         ln -vs -- "''${target/^${firmware}/$out}.xz" "$out/$link.xz"
       else
         ln -vs -- "''${target/^${firmware}/$out}" "$out/$link"