X-Git-Url: http://git.ipfire.org/?p=ipfire-2.x.git;a=blobdiff_plain;f=src%2Fstripper;fp=src%2Fstripper;h=199d17f6a0ced2d67695c87a478a596ab2d1d6cc;hp=0000000000000000000000000000000000000000;hb=fc44fa1f06fd8db9cdc3f37c29bb240024b10676;hpb=21e72899d9b92a6da05983e3d64cbe98ef2f9b1f diff --git a/src/stripper b/src/stripper new file mode 100755 index 0000000000..199d17f6a0 --- /dev/null +++ b/src/stripper @@ -0,0 +1,27 @@ +#!/bin/bash + +function _strip() { + local file=${1} + + local cmd="${STRIP-strip}" + + case "$(file -bi ${file})" in + application/x-sharedlib*) + cmd="${cmd} --strip-debug --remove-section=.comment --remove-section=.note" + ;; + *) + cmd="${cmd} --strip-unneeded" + ;; + esac + + echo "Stripping ${file}..." + ${cmd} ${file} +} + +for dir in $@; do + find ${dir} -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) \ + | file -N -f - | sed -n -e 's/^\(.*\):[ ]*.*ELF.*, not stripped/\1/p' | + while read file; do + _strip ${file} + done +done