summary refs log tree commit diff
path: root/pkgs/desktops/deepin
diff options
context:
space:
mode:
authorJosé Romildo Malaquias <malaquias@gmail.com>2019-05-04 19:22:57 -0300
committerJosé Romildo Malaquias <malaquias@gmail.com>2019-05-04 19:22:57 -0300
commitf17ab3dcff1313091d3a48f36d83d3052d64f823 (patch)
treee96a272ea0a952bd047aa785b48fd364e6b8657d /pkgs/desktops/deepin
parent1b7597f3dc261e38758e8b730aab311dc6cbae27 (diff)
downloadnixpkgs-f17ab3dcff1313091d3a48f36d83d3052d64f823.tar
nixpkgs-f17ab3dcff1313091d3a48f36d83d3052d64f823.tar.gz
nixpkgs-f17ab3dcff1313091d3a48f36d83d3052d64f823.tar.bz2
nixpkgs-f17ab3dcff1313091d3a48f36d83d3052d64f823.tar.lz
nixpkgs-f17ab3dcff1313091d3a48f36d83d3052d64f823.tar.xz
nixpkgs-f17ab3dcff1313091d3a48f36d83d3052d64f823.tar.zst
nixpkgs-f17ab3dcff1313091d3a48f36d83d3052d64f823.zip
deepin: add option to enable searching FHS hard coded paths in binaries
Diffstat (limited to 'pkgs/desktops/deepin')
-rwxr-xr-xpkgs/desktops/deepin/setup-hook.sh27
1 files changed, 19 insertions, 8 deletions
diff --git a/pkgs/desktops/deepin/setup-hook.sh b/pkgs/desktops/deepin/setup-hook.sh
index 63a43bb5840..ce1d7330a22 100755
--- a/pkgs/desktops/deepin/setup-hook.sh
+++ b/pkgs/desktops/deepin/setup-hook.sh
@@ -1,17 +1,28 @@
 # Helper functions for deepin packaging
 
 searchHardCodedPaths() {
-    # looks for ocurrences of hard coded paths in given (current)
-    # directory and command invocations for the purpose of debugging a
-    # derivation
+    # Usage:
+    #
+    #   searchHardCodedPaths [-a] [<path>]
+    #
+    # Looks for ocurrences of FHS hard coded paths and command
+    # invocations in the given path (default: current directory) for
+    # the purpose of debugging a derivation. The option -a enables
+    # processing binary files as if they were text.
+
+    local binary
+    if [ "$1" = "-a" ]; then
+        binary="-a"
+        shift
+    fi
 
-    local dir=$1
+    local path=$1
 
-    echo ----------- looking for command invocations
-    grep --color=always -r -E '\<(ExecStart|Exec|startDetached|execute|exec\.(Command|LookPath))\>' $dir || true
+    echo ----------- looking for command invocations in $path
+    grep --color=always -r -E '\<(ExecStart|Exec|startDetached|execute|exec\.(Command|LookPath))\>' $path || true
 
-    echo ----------- looking for hard coded paths
-    grep --color=always -a -r -E '/(usr|bin|sbin|etc|var|opt)\>' $dir || true
+    echo ----------- looking for hard coded paths in $path
+    grep --color=always $binary -r -E '/(usr|bin|sbin|etc|var|opt)\>' $path || true
 
     echo ----------- done
 }