Bug #239529 - Fix 'doins' to work with symlinks to directories, like it did
authorZac Medico <zmedico@gentoo.org>
Sun, 5 Oct 2008 03:39:27 +0000 (03:39 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 5 Oct 2008 03:39:27 +0000 (03:39 -0000)
before the changes from bug #210575.

svn path=/main/trunk/; revision=11623

bin/doins

index 57a21c4bb29a91dd3f11773e51f914725fb620b4..12a48eb69729c8b25cfefabb0c7b779a179753cb 100755 (executable)
--- a/bin/doins
+++ b/bin/doins
@@ -64,9 +64,17 @@ for x in "$@" ; do
                else
                        pushd "${x%/*}" >/dev/null
                fi
-               find "${x##*/}" -type d -exec dodir "${INSDESTTREE}/{}" \;
-               find "${x##*/}" \( -type f -or -type l \) -print0 | _xdoins
-               popd >/dev/null
+               x=${x##*/}
+               # Follow any symlinks recursively until we've got
+               # a normal directory for 'find' to traverse.
+               while [ -L "$x" ] ; do
+                       pushd "$(readlink "$x")"
+                       x=${PWD##*/}
+                       pushd ${PWD%/*}
+               done
+               find "$x" -type d -exec dodir "${INSDESTTREE}/{}" \;
+               find "$x" \( -type f -or -type l \) -print0 | _xdoins
+               while popd >/dev/null ; do true ; done
                ((++success))
        else
                _doins "${x}" && ((++success))