chiark / gitweb /
Get link target right for subdirs
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 16 Dec 2015 23:46:25 +0000 (23:46 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 16 Dec 2015 23:46:25 +0000 (23:46 +0000)
infra/makelinks

index 96ec405..46c901e 100755 (executable)
@@ -76,6 +76,18 @@ process_object () {
     inhome="$HOME/$underhome"
     prhome="~/$underhome"
     linktarget="$basepath/$ours"
+    chompy="$underhome"
+    while true; do
+       case "$chompy" in
+        *?/?*)
+           linktarget="../$linktarget"
+           chompy="${chompy%/*}"
+           ;;
+       *)
+           break
+           ;;
+       esac
+    done
     if [ "$inhome" -ef "$ours" ]; then
        good "already symlinked here"
     elif [ -h "$inhome" ]; then