Make stripping more efficient.
[ipfire-2.x.git] / src / stripper
CommitLineData
fc44fa1f
MT
1#!/bin/bash
2
3function _strip() {
4 local file=${1}
5
6 local cmd="${STRIP-strip}"
7
8 case "$(file -bi ${file})" in
9 application/x-sharedlib*)
10 cmd="${cmd} --strip-debug --remove-section=.comment --remove-section=.note"
11 ;;
12 *)
13 cmd="${cmd} --strip-unneeded"
14 ;;
15 esac
16
17 echo "Stripping ${file}..."
18 ${cmd} ${file}
19}
20
21for dir in $@; do
22 find ${dir} -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) \
23 | file -N -f - | sed -n -e 's/^\(.*\):[ ]*.*ELF.*, not stripped/\1/p' |
24 while read file; do
25 _strip ${file}
26 done
27done