added xf86-input-evtouch package Support for touchscreens with xf86
[openadk.git] / scripts / rstrip.sh
blobd897c0ef3f30846ea965b18dd82c960f1bd68a14
1 # This file is part of the OpenADK project. OpenADK is copyrighted
2 # material, please see the LICENCE file in the top-level directory.
4 [[ -n $BASH_VERSION ]] && shopt -s extglob
6 SELF=${0##*/}
8 if [[ -z $prefix ]]; then
9 echo >&2 "$SELF: strip command not defined ('prefix' variable not set)"
10 exit 1
13 if [[ $1 = +keep ]]; then
14 stripcomm=
15 shift
16 else
17 stripcomm=" -R .comment"
20 TARGETS=$*
22 if [[ -z $TARGETS ]]; then
23 echo >&2 "$SELF: no directories / files specified"
24 echo >&2 "usage: $SELF [PATH...]"
25 exit 1
28 find $TARGETS -type f -a -exec file {} \; | \
29 while IFS= read -r line; do
30 F=${line%%:*}
31 V=${F##*/fake-+([!/])/}
32 T="${prefix}strip"
33 T=$T$stripcomm
34 case $line in
35 *ELF*executable*statically\ linked*)
36 echo >&2 "$SELF: *WARNING* '$V' is not dynamically linked!"
38 *ELF*relocatable*,\ not\ stripped*)
39 echo >&2 "$SELF: *WARNING* '$V' is a relocatable!"
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 # kernel module parametres must not be stripped off
48 T="$T --strip-unneeded $(echo $(${prefix}nm $F | \
49 sed -n -e '/__param_/s/^.*__param_/-K /p' \
50 -e '/__module_parm_/s/^.*__module_parm_/-K /p'))"
51 S='kernel module' ;;
52 *ELF*shared\ object*,\ not\ stripped*)
53 S='shared object' ;;
55 continue ;;
56 esac
57 echo "$SELF: $V:$S"
58 echo "-> $T $F"
59 eval "$T $F"
60 done