@@ -180,6 +180,7 @@ try_cp() {
180
180
[ "$VERBOSE " == 1 ] && \
181
181
echo -n "cp: "
182
182
cp $varg -f "$1 " "$2 "||exit 1
183
+ chmod $varg 755 "$2 "||exit 1
183
184
fi
184
185
}
185
186
@@ -380,6 +381,13 @@ for binary in "${BINARY_LIST[@]}"
380
381
IS_ELF32 ="$(grep -q 'ELF 32 -bit'<<<"$FILE_INFO ")"
381
382
IS_EXECUTABLE="$(grep -o 'executable'<<<"$FILE_INFO ")"
382
383
info_msg "$YELLOW [ $binary_number ]: $BLUE [$binary_name ] ${GREEN} ..."
384
+ if [ "$HARD_LINKS " == 1 ] && [[ -n "$IS_SCRIPT " || -n "$IS_STATIC " ]]
385
+ then
386
+ hard_links=0
387
+ with_sharun=1
388
+ fi
389
+ hard_links=${HARD_LINKS:= 0}
390
+ with_sharun=${WITH_SHARUN:= 0}
383
391
if [ -n "$IS_EXECUTABLE " ] && [[ "$ANY_EXECUTABLE " == 1 || -n "$IS_ELF " ]]
384
392
then
385
393
needed_libs="$(print_needed "$binary_src_pth ")"
@@ -391,17 +399,12 @@ for binary in "${BINARY_LIST[@]}"
391
399
if [[ -n "$LIBS " && ! -n "$IS_SCRIPT " && ! -n "$IS_STATIC " ]]
392
400
then
393
401
INTERPRETER="$(basename "$(grep 'ld-linux'<<<"$LIBS "|cut -d'=' -f1 |sed 's|\t||' )")"
394
- [[ "$CREATE_LINKS " == 1 && "$HARD_LINKS " == 1 && ! -x "${dst_dir} / sharun" ]] && \
395
- WITH_SHARUN =1
402
+ [[ "$CREATE_LINKS " == 1 && "$hard_links " == 1 && ! -x "${dst_dir} / sharun" ]] && \
403
+ with_sharun =1
396
404
else
397
- if [[ -n "$IS_SCRIPT " || -n "$IS_STATIC " ]]
398
- then
399
- [ "$HARD_LINKS " == 1 ] && \
400
- WITH_SHARUN=1 && HARD_LINKS=0
401
- fi
402
405
bin_dir_pth="$sharun_bin_dir_pth "
403
406
fi
404
- if [[ "$WITH_SHARUN " == 1 && ! -x "${dst_dir} / sharun" ]]
407
+ if [[ "$with_sharun " == 1 && ! -x "${dst_dir} / sharun" ]]
405
408
then
406
409
TMP_SHARUN="/tmp/sharun-$(uname -m)$([ "$UPX_SHARUN " != 1 ]||echo -upx)"
407
410
SHARUN="${SHARUN:= " $( readlink -f " $( which_exe sharun) " ) " } "
@@ -455,7 +458,7 @@ for binary in "${BINARY_LIST[@]}"
455
458
if [ "$CREATE_LINKS " == 1 ]
456
459
then
457
460
try_mkdir "$sharun_bin_dir_pth "
458
- [ "$HARD_LINKS " == 1 ] && \
461
+ [ "$hard_links " == 1 ] && \
459
462
ln_args='-Pf'||ln_args='-sf'
460
463
(try_cd "$sharun_bin_dir_pth "
461
464
[ "$VERBOSE " != 1 ]||echo -n "ln: "
@@ -489,7 +492,7 @@ for binary in "${BINARY_LIST[@]}"
489
492
[[ -n "$lib_src_real_pth " && "${LIBRARIES["$lib_src_real_pth"]} " != 1 ]]
490
493
then
491
494
try_mkdir "$lib_dst_dir_pth "
492
- if [[ "$HARD_LINKS " == 1 && ! -L "${dst_dir} / ${lib_dir} " ]]
495
+ if [[ "$hard_links " == 1 && ! -L "${dst_dir} / ${lib_dir} " ]]
493
496
then
494
497
(try_cd "$dst_dir "
495
498
try_ln shared/$lib_dir $lib_dir )||exit 1
0 commit comments