about summary refs log tree commit diff
path: root/pkgs/build-support/setup-hooks
diff options
context:
space:
mode:
authorTaahir Ahmed <ahmed.taahir@gmail.com>2017-04-15 21:50:13 -0500
committerTaahir Ahmed <ahmed.taahir@gmail.com>2017-04-24 10:56:53 -0500
commit8b9f153bb9c8156ec4f3d56d61845e432d19dcd6 (patch)
treea210b62e4f8b8747c317425fd6dd1ecf403cbf70 /pkgs/build-support/setup-hooks
parent100919ab5b69cbbb26886421aacc692467c7fec4 (diff)
downloadnixlib-8b9f153bb9c8156ec4f3d56d61845e432d19dcd6.tar
nixlib-8b9f153bb9c8156ec4f3d56d61845e432d19dcd6.tar.gz
nixlib-8b9f153bb9c8156ec4f3d56d61845e432d19dcd6.tar.bz2
nixlib-8b9f153bb9c8156ec4f3d56d61845e432d19dcd6.tar.lz
nixlib-8b9f153bb9c8156ec4f3d56d61845e432d19dcd6.tar.xz
nixlib-8b9f153bb9c8156ec4f3d56d61845e432d19dcd6.tar.zst
nixlib-8b9f153bb9c8156ec4f3d56d61845e432d19dcd6.zip
wrapGAppsHook: Correct `wrapProgram` invocations
This change fixes several defects in the way `wrapGAppsHook` selected
the executable to wrap.

Previously, it would wrap any top-level files in the target `/bin` and
`/libexec` directories, including directories and non-executable
files.  In addition, it failed to wrap files in subdirectories.

Now, it uses `find` to iterate over these directory hierarchies,
selecting only executable files for wrapping.
Diffstat (limited to 'pkgs/build-support/setup-hooks')
-rw-r--r--pkgs/build-support/setup-hooks/wrap-gapps-hook.sh7
1 files changed, 4 insertions, 3 deletions
diff --git a/pkgs/build-support/setup-hooks/wrap-gapps-hook.sh b/pkgs/build-support/setup-hooks/wrap-gapps-hook.sh
index 3cad1838d260..5d1cce6ee049 100644
--- a/pkgs/build-support/setup-hooks/wrap-gapps-hook.sh
+++ b/pkgs/build-support/setup-hooks/wrap-gapps-hook.sh
@@ -36,9 +36,10 @@ wrapGAppsHook() {
   done
 
   if [ -z "$dontWrapGApps" ]; then
-    for i in $prefix/bin/* $prefix/libexec/*; do
-      echo "Wrapping app $i"
-      wrapProgram "$i" "${gappsWrapperArgs[@]}"
+    find "${prefix}/bin" "${prefix}/libexec" -type f -executable -print0 \
+    | while IFS= read -r -d '' file; do
+      echo "Wrapping program $file"
+      wrapProgram "$file" "${gappsWrapperArgs[@]}"
     done
   fi
 }