diff options
author | Nikolay Amiantov <ab@fmap.me> | 2016-07-06 22:56:21 +0300 |
---|---|---|
committer | Nikolay Amiantov <ab@fmap.me> | 2016-07-12 22:22:28 +0300 |
commit | bd0ab027c1c83eb7c26ed50bcf0d77da0c31a1d8 (patch) | |
tree | fd3c4b84f19ed761196907617f6ba9ef1073e66a /nixos/modules/system/boot/stage-1.nix | |
parent | 90ad879753c476154e65667f8dec12cf5a6c89d4 (diff) | |
download | nixlib-bd0ab027c1c83eb7c26ed50bcf0d77da0c31a1d8.tar nixlib-bd0ab027c1c83eb7c26ed50bcf0d77da0c31a1d8.tar.gz nixlib-bd0ab027c1c83eb7c26ed50bcf0d77da0c31a1d8.tar.bz2 nixlib-bd0ab027c1c83eb7c26ed50bcf0d77da0c31a1d8.tar.lz nixlib-bd0ab027c1c83eb7c26ed50bcf0d77da0c31a1d8.tar.xz nixlib-bd0ab027c1c83eb7c26ed50bcf0d77da0c31a1d8.tar.zst nixlib-bd0ab027c1c83eb7c26ed50bcf0d77da0c31a1d8.zip |
nixos stage-1: recursively process binaries and libraries
Diffstat (limited to 'nixos/modules/system/boot/stage-1.nix')
-rw-r--r-- | nixos/modules/system/boot/stage-1.nix | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix index 5e6554324ca4..d031b8a2751b 100644 --- a/nixos/modules/system/boot/stage-1.nix +++ b/nixos/modules/system/boot/stage-1.nix @@ -81,9 +81,9 @@ let # Copy ld manually since it isn't detected correctly cp -pv ${pkgs.glibc.out}/lib/ld*.so.? $out/lib - # Copy all of the needed libraries for the binaries - for BIN in $(find $out/{bin,sbin} -type f); do - echo "Copying libs for bin $BIN" + # Copy all of the needed libraries + find $out/bin $out/lib -type f | while read BIN; do + echo "Copying libs for executable $BIN" LDD="$(ldd $BIN)" || continue LIBS="$(echo "$LDD" | awk '{print $3}' | sed '/^$/d')" for LIB in $LIBS; do @@ -104,13 +104,17 @@ let stripDirs "lib bin" "-s" # Run patchelf to make the programs refer to the copied libraries. - for i in $out/bin/* $out/lib/*; do if ! test -L $i; then nuke-refs -e $out $i; fi; done + find $out/bin $out/lib -type f | while read i; do + if ! test -L $i; then + nuke-refs -e $out $i + fi + done - for i in $out/bin/*; do - if ! test -L $i; then - echo "patching $i..." - patchelf --set-interpreter $out/lib/ld*.so.? --set-rpath $out/lib $i || true - fi + find $out/bin -type f | while read i; do + if ! test -L $i; then + echo "patching $i..." + patchelf --set-interpreter $out/lib/ld*.so.? --set-rpath $out/lib $i || true + fi done # Make sure that the patchelf'ed binaries still work. |