cpt

[ARCHIVED] Carbs Packaging Tools
git clone git://git.ckyln.com/~cem/cpt.git
Log | Files | Refs | README | LICENSE

commit a1c84eb491984a16fd69add601bbb863f23b0dcf
parent 08b893155523c67a989a333277b960952812d168
Author: black <dylan.araps@gmail.com>
Date:   Fri, 30 Aug 2019 14:06:24 +0000

Merge pull request #47 from kisslinux/nofile

stripping: swap to readelf
Diffstat:
Mkiss | 42++++++++++++++++++++----------------------
1 file changed, 20 insertions(+), 22 deletions(-)

diff --git 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 }