OSDN Git Service

lndir: fix symbolic dir handling
[android-x86/bootable-newinstaller.git] / initrd / bin / lndir
index 7511132..778fa27 100755 (executable)
@@ -20,11 +20,12 @@ linkdir()
        local d="$PWD"
        cd "$odir" && cd "$1"
        for f in * .*; do
-               [ "$f" = "." -o "$f" = ".." ] && continue
-               if [ -d "$f" ]; then
-                       linkdir "$f" "$d/$f"
-               elif [ -e "$f" ]; then
-                       ln $verbose "$f" "$d"
+               if [ "$f" != "." -a "$f" != ".." -a -e "$f" ]; then
+                       if [ -d "$f" -a ! -L "$f" ]; then
+                               linkdir "$f" "$d/$f"
+                       else
+                               ln $verbose "$f" "$d"
+                       fi
                fi
        done
        cd "$odir"