aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornoreply@github.com <noreply@github.com>2019-08-30 14:06:23 +0000
committernoreply@github.com <noreply@github.com>2019-08-30 14:06:23 +0000
commit5b1ed78f8436f6137ce7ecbb8e44e62877a93089 (patch)
tree36ac09973de4557e6fb023f4d25ae7620f9369a6
parent775a7992cb1614fe9b0e16aade3aa9bd2fc718ac (diff)
parent19cee87c0bbcf6c8ee2a0b763af0161ae9904be5 (diff)
downloadcpt-5b1ed78f8436f6137ce7ecbb8e44e62877a93089.tar.gz
Merge pull request #47 from kisslinux/nofile
stripping: swap to readelf FossilOrigin-Name: 9dc2ecab111c1e9a65befcb82197195d19560aa39b91141d97d41643ae62718e
-rwxr-xr-xkiss42
1 files changed, 20 insertions, 22 deletions
diff --git a/kiss b/kiss
index 47b4c88..eddbb95 100755
--- a/kiss
+++ b/kiss
@@ -257,29 +257,27 @@ pkg_strip() {
# Strip only files matching the below mime-types from the package
# directory. No alternative to 'file' here sadly.
- find "$pkg_dir/$1" -type f -exec file -i {} + |
- while IFS=': ' read -r bin mime; do
- case $mime in
- application/x-sharedlib*|\
- application/x-pie-executable*)
- strip_opts=--strip-unneeded
- ;;
-
- application/x-archive*)
- strip_opts=--strip-debug
- ;;
-
- application/x-executable*)
- strip_opts=--strip-all
- ;;
-
- *) continue ;;
- esac
+ find "$pkg_dir/$1" -type f | while read -r file; do
+ case "$(readelf -h "$file" 2>/dev/null)" in
+ *" DYN "*)
+ strip_opt=--strip-unneeded
+ ;;
- # Suppress errors here as some binaries and libraries may
- # fail to strip. This is OK.
- strip "$strip_opts" "$bin" 2>/dev/null &
- done
+ *" REL "*)
+ strip_opt=--strip-debug
+ ;;
+
+ *" EXEC "*)
+ strip_opt=--strip-all
+ ;;
+
+ *) continue ;;
+ esac
+
+ # Suppress errors here as some binaries and libraries may
+ # fail to strip. This is OK.
+ strip "$strip_opt" "$file" 2>/dev/null &
+ done
wait
}