mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-28 01:43:15 +00:00
Merge pull request #284487 from alyssais/compressFirmwareXz
compressFirmwareXz: fix symlink type check
This commit is contained in:
commit
50071d87c7
@ -3,7 +3,9 @@
|
||||
firmware:
|
||||
|
||||
let
|
||||
args = lib.optionalAttrs (firmware ? meta) { inherit (firmware) meta; };
|
||||
args = {
|
||||
allowedRequisites = [];
|
||||
} // lib.optionalAttrs (firmware ? meta) { inherit (firmware) meta; };
|
||||
in
|
||||
|
||||
runCommand "${firmware.name}-xz" args ''
|
||||
@ -15,10 +17,13 @@ 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"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Checking for broken symlinks:"
|
||||
find -L $out -type l -print -execdir false -- '{}' '+'
|
||||
''
|
||||
|
Loading…
Reference in New Issue
Block a user