OpenWrt – Blame information for rev 3
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | #!/usr/bin/env bash |
2 | # |
||
3 | # Copyright (C) 2006 OpenWrt.org |
||
4 | # |
||
5 | # This is free software, licensed under the GNU General Public License v2. |
||
6 | # See /LICENSE for more information. |
||
7 | # |
||
8 | SELF=${0##*/} |
||
9 | |||
10 | [ -z "$STRIP" ] && { |
||
11 | echo "$SELF: strip command not defined (STRIP variable not set)" |
||
12 | exit 1 |
||
13 | } |
||
14 | |||
15 | TARGETS=$* |
||
16 | |||
17 | [ -z "$TARGETS" ] && { |
||
18 | echo "$SELF: no directories / files specified" |
||
19 | echo "usage: $SELF [PATH...]" |
||
20 | exit 1 |
||
21 | } |
||
22 | |||
23 | find $TARGETS -type f -a -exec file {} \; | \ |
||
24 | sed -n -e 's/^\(.*\):.*ELF.*\(executable\|relocatable\|shared object\).*,.*/\1:\2/p' | \ |
||
25 | ( |
||
26 | IFS=":" |
||
27 | while read F S; do |
||
28 | echo "$SELF: $F: $S" |
||
29 | [ "${S}" = "relocatable" ] && { |
||
30 | eval "$STRIP_KMOD $F" |
||
31 | } || { |
||
32 | b=$(stat -c '%a' $F) |
||
33 | [ -z "$PATCHELF" ] || [ -z "$TOPDIR" ] || { |
||
34 | old_rpath="$($PATCHELF --print-rpath $F)"; new_rpath="" |
||
35 | for path in $old_rpath; do |
||
36 | case "$path" in |
||
3 | office | 37 | /lib/[^/]*|/usr/lib/[^/]*|\$ORIGIN/*) new_rpath="${new_rpath:+$new_rpath:}$path" ;; |
1 | office | 38 | *) echo "$SELF: $F: removing rpath $path" ;; |
39 | esac |
||
40 | done |
||
41 | [ "$new_rpath" = "$old_rpath" ] || $PATCHELF --set-rpath "$new_rpath" $F |
||
42 | } |
||
43 | eval "$STRIP $F" |
||
44 | a=$(stat -c '%a' $F) |
||
45 | [ "$a" = "$b" ] || chmod $b $F |
||
46 | } |
||
47 | done |
||
48 | true |
||
49 | ) |