|
Revision 3186, 1.5 kB
(checked in by tg, 1 year ago)
|
add debugging output, trunk is currently unusable
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
[[ -n $BASH_VERSION ]] && shopt -s extglob |
|---|
| 8 |
|
|---|
| 9 |
SELF=${0 |
|---|
| 10 |
|
|---|
| 11 |
if [[ -z $prefix ]]; then |
|---|
| 12 |
echo >&2 "$SELF: strip command not defined ('prefix' variable not set)" |
|---|
| 13 |
exit 1 |
|---|
| 14 |
fi |
|---|
| 15 |
|
|---|
| 16 |
if [[ $1 = +keep ]]; then |
|---|
| 17 |
stripcomm= |
|---|
| 18 |
shift |
|---|
| 19 |
else |
|---|
| 20 |
stripcomm=" -R .comment" |
|---|
| 21 |
fi |
|---|
| 22 |
|
|---|
| 23 |
TARGETS=$* |
|---|
| 24 |
|
|---|
| 25 |
if [[ -z $TARGETS ]]; then |
|---|
| 26 |
echo >&2 "$SELF: no directories / files specified" |
|---|
| 27 |
echo >&2 "usage: $SELF [PATH...]" |
|---|
| 28 |
exit 1 |
|---|
| 29 |
fi |
|---|
| 30 |
|
|---|
| 31 |
find $TARGETS -type f -a -exec file {} \; | \ |
|---|
| 32 |
while IFS= read -r line; do |
|---|
| 33 |
F=${line%%:*} |
|---|
| 34 |
V=${F |
|---|
| 35 |
T="${prefix}strip" |
|---|
| 36 |
[[ $F = */fwwif/* ]] || T=$T$stripcomm |
|---|
| 37 |
case $line in |
|---|
| 38 |
*ELF*executable*statically\ linked*) |
|---|
| 39 |
echo >&2 "$SELF: *WARNING* '$V' is not dynamically linked!" |
|---|
| 40 |
;; |
|---|
| 41 |
esac |
|---|
| 42 |
case $line in |
|---|
| 43 |
*ELF*executable*,\ not\ stripped*) |
|---|
| 44 |
S=executable ;; |
|---|
| 45 |
*/lib/modules/2.*.o:*ELF*relocatable*,\ not\ stripped* | \ |
|---|
| 46 |
*/lib/modules/2.*.ko:*ELF*relocatable*,\ not\ stripped*) |
|---|
| 47 |
|
|---|
| 48 |
T="$T --strip-unneeded $(echo $(${prefix}nm $F | \ |
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 |
S='kernel module' ;; |
|---|
| 52 |
*ELF*relocatable*,\ not\ stripped*) |
|---|
| 53 |
S=relocatable ;; |
|---|
| 54 |
*ELF*shared\ object*,\ not\ stripped*) |
|---|
| 55 |
S='shared object' ;; |
|---|
| 56 |
*) |
|---|
| 57 |
continue ;; |
|---|
| 58 |
esac |
|---|
| 59 |
echo "$SELF: $V:$S" |
|---|
| 60 |
echo "+ $T $F" |
|---|
| 61 |
eval "$T $F" |
|---|
| 62 |
done |
|---|