Template
1
0
mirror of https://github.com/bol-van/zapret2.git synced 2026-03-14 06:13:09 +00:00

base.sh: detect hard links to busybox

This commit is contained in:
bol-van
2026-01-03 00:39:29 +03:00
parent 0cad2329a1
commit 4f6510daf1

View File

@@ -172,15 +172,24 @@ unique()
is_linked_to_busybox() is_linked_to_busybox()
{ {
local IFS F P local IFS F P BB
BB="$(which busybox)"
IFS=: IFS=:
for path in $PATH; do for path in $PATH; do
F=$path/$1 F="$path/$1"
P="$(readlink $F)" if [ -L "$F" ]; then
if [ -z "$P" ] && [ -x $F ] && [ ! -L $F ]; then return 1; fi P="$(readlink $F)"
[ "${P%busybox*}" != "$P" ] && return if [ -z "$P" ] && [ -x $F ] && [ ! -L $F ]; then return 1; fi
[ "${P%busybox*}" != "$P" ] && return
elif [ -f "$F" -a -n "$BB" ]; then
# possible hardlink
[ $(get_dir_inode "$F") = $(get_dir_inode "$BB") ]
return
fi
done done
return 1
} }
get_dir_inode() get_dir_inode()
{ {