diff --git a/scripts/functions b/scripts/functions index a879cd62d..1cfb1634e 100644 --- a/scripts/functions +++ b/scripts/functions @@ -130,10 +130,20 @@ CanonPath() if [ -L "$f1" ]; then local d d=$(dirname -- "$f1") - d=$(readlink -vm -- "$d") + # Do not resolve symbolic links for bin catalogs that be merged. + # For more information about usrmerge: https://altlinux.org/Usrmerge. + case "$d" in + /bin|/sbin) ;; + *) d=$(readlink -vm -- "$d") ;; + esac f2="${d%/}/${f1##*/}" else f2=$(readlink -vm -- "$f1") + # Strip /usr for bin catalogs if it was added due to resolving symbolic + # link. + case "$f1" in + /bin/*|/sbin/*) f2="${f2#/usr}";; + esac fi [ "$f1" = "$f2" ] || Verbose "CanonPath2: $f1 -> $f2" echo "$f2"