X-Git-Url: http://git.ozo.com/?a=blobdiff_plain;f=scripts%2Fbundle-libraries.sh;h=bfe681ad604e0a4f6f59174fa0ffecc309cfed1a;hb=a9a43f3d791da40893832616e79bbeed198a1ddb;hp=f254d4da47058b9456d42efc288d2d19790c587f;hpb=ab44f8fc0df35035c4bef316df48dd3764fec716;p=openwrt%2F.git diff --git a/scripts/bundle-libraries.sh b/scripts/bundle-libraries.sh index f254d4da47..bfe681ad60 100755 --- a/scripts/bundle-libraries.sh +++ b/scripts/bundle-libraries.sh @@ -97,6 +97,18 @@ _runas_so() { } } +_patch_ldso() { + _cp "$1" "$1.patched" + sed -i -e 's,/\(usr\|lib\|etc\)/,/###/,g' "$1.patched" + + if "$1.patched" 2>&1 | grep -q -- --library-path; then + _mv "$1.patched" "$1" + else + echo "binary patched ${1##*/} not executable, using original" >&2 + rm -f "$1.patched" + fi +} + for LDD in ${PATH//://ldd }/ldd; do "$LDD" --version >/dev/null 2>/dev/null && break LDD="" @@ -135,6 +147,7 @@ for BIN in "$@"; do [ -f "$token" -a ! -f "$dest" ] && { _md "$ddir" _cp "$token" "$dest" + [ -n "$LDSO" ] && _patch_ldso "$dest" } ;; esac done