From: Ian Jackson Date: Wed, 16 Dec 2015 23:46:25 +0000 (+0000) Subject: Get link target right for subdirs X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=ian-dotfiles.git;a=commitdiff_plain;h=4a16ee9b9048392d29fc54b5d7215ef1ff1c20cf;ds=sidebyside Get link target right for subdirs --- diff --git a/infra/makelinks b/infra/makelinks index 96ec405..46c901e 100755 --- a/infra/makelinks +++ b/infra/makelinks @@ -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