ignore ld preload config
This commit is contained in:
parent
3716d59cd9
commit
e816bafc35
11
packelf.sh
11
packelf.sh
|
@ -11,6 +11,11 @@ dst="$2"
|
|||
shift
|
||||
shift
|
||||
|
||||
libs="$(ldd "$src" | grep -F '/' | sed -E 's|[^/]*/([^ ]+).*?|/\1|')"
|
||||
ld_so="$(echo "$libs" | grep -F '/ld-linux-')"
|
||||
ld_so="$(basename "$ld_so")"
|
||||
program="$(basename "$src")"
|
||||
|
||||
cat >"$dst" <<EOF
|
||||
#!/bin/bash
|
||||
tmp_dir="\$(mktemp -d)"
|
||||
|
@ -21,13 +26,11 @@ if ! (touch "\$check_path" && chmod +x "\$check_path" && [ -x "\$check_path" ]);
|
|||
tmp_dir="\$(TMPDIR="\$(pwd)" mktemp -d)"
|
||||
fi
|
||||
sed '1,/^#__END__$/d' "\$0" | tar -xz -C "\$tmp_dir"
|
||||
"\$tmp_dir/LD_SO" --library-path "\$tmp_dir" "\$tmp_dir/PROGRAM" "\$@"
|
||||
sed -i 's@/etc/ld.so.preload@/etc/___so.preload@g' "\$tmp_dir/$ld_so"
|
||||
"\$tmp_dir/$ld_so" --library-path "\$tmp_dir" "\$tmp_dir/$program" "\$@"
|
||||
exit \$?
|
||||
#__END__
|
||||
EOF
|
||||
|
||||
libs="$(ldd "$src" | grep -F '/' | sed -E 's|[^/]*/([^ ]+).*?|/\1|')"
|
||||
ld_so="$(echo "$libs" | grep -F '/ld-linux-')"
|
||||
sed -E -i -e 's|PROGRAM|'"$(basename "$src")"'|' -e 's|LD_SO|'"$(basename "$ld_so")"'|' "$dst"
|
||||
tar -czh --transform 's/.*\///g' "$src" $libs "$@" >>"$dst" 2> >(grep -v 'Removing leading' >&2)
|
||||
chmod +x "$dst"
|
||||
|
|
Loading…
Reference in New Issue
Block a user