@@ -131,10 +131,12 @@ ldd_libs() {
131
131
132
132
get_libs () {
133
133
unset libs libs4libs
134
- if [[ " $STRACE_MODE " == 1 && ! -n " $IS_SO " ]]
134
+ if [ " $STRACE_MODE " == 1 ] && ! is_so
135
135
then
136
136
local libs_file=" /tmp/libs.$$ "
137
- strace -f -e trace=openat --always-show-pid -o " $libs_file " " $1 " " ${STRACE_CMD_ARGS[@]} " & > /dev/null &
137
+ [[ " $( strace --help) " =~ always-show-pid ]] && \
138
+ STRACE_ARGS=' --always-show-pid' || unset STRACE_ARGS
139
+ strace -f -e trace=openat $STRACE_ARGS -o " $libs_file " " $1 " " ${STRACE_CMD_ARGS[@]} " & > /dev/null &
138
140
sleep $STRACE_TIME
139
141
local pids=" $( cut -d ' ' -f1< " $libs_file " | sort -u) "
140
142
kill $pids 2> /dev/null
@@ -210,6 +212,8 @@ try_cd() {
210
212
211
213
find_so() { find "$@ " -name '*.so' -o -name '*.so.*' 2 >/dev/null ; }
212
214
215
+ is_so() { [ -n "$IS_SO " ] && [[ "${binary_name,,} " =~ .* (\.so$| \.so\..* ) || "${binary_real_name,,} " =~ .* (\.so$| \.so\..* ) ]] ; }
216
+
213
217
check_url_stat_code() {
214
218
set -o pipefail
215
219
if is_exe_exist curl
@@ -400,6 +404,7 @@ for binary in "${BINARY_LIST[@]}"
400
404
IS_ELF32 ="$(grep -q 'ELF 32 -bit'<<<"$FILE_INFO ")"
401
405
IS_SO="$(grep -o 'shared object'<<<"$FILE_INFO ")"
402
406
IS_EXECUTABLE="$(grep -o 'executable'<<<"$FILE_INFO ")"
407
+ IS_EXECUTABLE="${IS_EXECUTABLE:= $(([ -n "$IS_SO" ] && ! is_so) && echo executable)} "
403
408
info_msg "$YELLOW [ $binary_number ]: $BLUE [$binary_name ] ${GREEN} ..."
404
409
if [ "$HARD_LINKS " == 1 ] && [[ -n "$IS_SCRIPT " || -n "$IS_STATIC " ]]
405
410
then
@@ -408,12 +413,11 @@ for binary in "${BINARY_LIST[@]}"
408
413
fi
409
414
hard_links=${HARD_LINKS:= 0}
410
415
with_sharun=${WITH_SHARUN:= 0}
411
- if [[ -n "$IS_EXECUTABLE " || -n " $IS_SO " ]] && [[ "$ANY_EXECUTABLE " == 1 || -n "$IS_ELF " ]]
416
+ if ([ -n "$IS_EXECUTABLE " ] || is_so) && [[ "$ANY_EXECUTABLE " == 1 || -n "$IS_ELF " ]]
412
417
then
413
418
needed_libs="$(print_needed "$binary_src_pth ")"
414
419
LIBS="$(get_libs "$binary_src_pth " "$needed_libs ")"
415
- [ -n "$IS_SO " ] && \
416
- LIBS="$(echo -e "$LIBS \n$binary "|sort -u|sed '/^$/d')"
420
+ is_so && LIBS="$(echo -e "$LIBS \n$binary "|sort -u|sed '/^$/d')"
417
421
if [[ -n "$LIBS " && ! -n "$IS_SCRIPT " && ! -n "$IS_STATIC " ]]
418
422
then
419
423
INTERPRETER="$(basename "$(grep 'ld-linux'<<<"$LIBS "|cut -d'=' -f1 |sed 's|\t||' )")"
@@ -424,7 +428,7 @@ for binary in "${BINARY_LIST[@]}"
424
428
fi
425
429
if [[ -n "$LIBS " || "$ANY_EXECUTABLE " == 1 ]]
426
430
then
427
- if [[ "$LIBS_ONLY " != 1 && ! -n " $IS_SO " ]]
431
+ if [ "$LIBS_ONLY " != 1 ] && ! is_so
428
432
then
429
433
if [[ "$with_sharun " == 1 && ! -x "${dst_dir} / sharun" ]]
430
434
then
@@ -531,14 +535,15 @@ for binary in "${BINARY_LIST[@]}"
531
535
fi
532
536
if [[ "${LIBRARIES["$lib_dst_pth"]} " != 1 ]]
533
537
then
534
- if [[ ! -n " $IS_SO " && "$hard_links " == 1 && ! -L "${dst_dir} / ${lib_dir} " ]]
538
+ if ! is_so && [[ "$hard_links " == 1 && ! -L "${dst_dir} / ${lib_dir} " ]]
535
539
then
536
540
(try_cd "$dst_dir "
537
541
try_ln shared/$lib_dir $lib_dir )||exit 1
538
542
fi
539
543
repath_needed_libs "$lib_dst_pth "
540
544
try_strip "$lib_dst_pth "
541
- if [[ ! "$lib_dst_pth " =~ "$INTERPRETER " ]]
545
+ if [[ ! "$lib_dst_pth " =~ "$INTERPRETER " && \
546
+ ! "$lib_dst_pth " =~ ld-[0 -9 ]\.[0 -9 ]+\.so ]]
542
547
then try_set_rpath "$lib_dst_pth "
543
548
fi
544
549
if [ "$WITH_HOOKS " == 1 ]
@@ -652,7 +657,7 @@ for binary in "${BINARY_LIST[@]}"
652
657
done
653
658
if [[ -n "$INTERPRETER " && "$PATCH_INTERPRETER " == 1 && "${LIBRARIES["${INTERPRETER}_patched"]} " != 1 ]]
654
659
then
655
- if [[ "$LIBS_ONLY " != 1 && ! -n " $IS_SO " ]]
660
+ if [ "$LIBS_ONLY " != 1 ] && ! is_so
656
661
then
657
662
(try_cd "$bin_dir_pth "
658
663
if [ -f "../$lib_dir /$INTERPRETER " ]
0 commit comments