about summary refs log tree commit diff
path: root/pkgs/build-support
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-28 15:24:50 -0500
commit2cd342cfb361cfa6413e6612028997079c2fa9ed (patch)
tree8433f5360e636de4d437635937788a2deeab5cf2 /pkgs/build-support
parent100919ab5b69cbbb26886421aacc692467c7fec4 (diff)
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')
-rw-r--r--pkgs/build-support/setup-hooks/wrap-gapps-hook.sh14
1 files changed, 10 insertions, 4 deletions
diff --git a/pkgs/build-support/setup-hooks/wrap-gapps-hook.sh b/pkgs/build-support/setup-hooks/wrap-gapps-hook.sh
index 3cad1838d260d..9891128a62317 100644
--- a/pkgs/build-support/setup-hooks/wrap-gapps-hook.sh
+++ b/pkgs/build-support/setup-hooks/wrap-gapps-hook.sh
@@ -35,10 +35,16 @@ wrapGAppsHook() {
     gappsWrapperArgs+=(--prefix $v : "$dummy")
   done
 
-  if [ -z "$dontWrapGApps" ]; then
-    for i in $prefix/bin/* $prefix/libexec/*; do
-      echo "Wrapping app $i"
-      wrapProgram "$i" "${gappsWrapperArgs[@]}"
+  if [[ -z "$dontWrapGApps" ]]; then
+    targetDirs=( "${prefix}/bin" "${prefix}/libexec" )
+    for targetDir in "${targetDirs[@]}"; do
+      if [[ -d "${targetDir}" ]]; then
+        find "${targetDir}" -type f -executable -print0 \
+          | while IFS= read -r -d '' file; do
+          echo "Wrapping program ${file}"
+          wrapProgram "${file}" "${gappsWrapperArgs[@]}"
+        done
+      fi
     done
   fi
 }