X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=ian-dotfiles.git;a=blobdiff_plain;f=infra%2Fmakelinks;h=46c901e9b0c0a3d17a62abac41802243d6e6e231;hp=f4d502c465045d940bdb2b1c9f5942b813acbb04;hb=4a16ee9b9048392d29fc54b5d7215ef1ff1c20cf;hpb=e466653b0879184e26ae58051e0aa9c158efdcf6 diff --git a/infra/makelinks b/infra/makelinks index f4d502c..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 @@ -109,15 +121,47 @@ process_object () { dots=$( find dot -mindepth 1 -maxdepth 1 -name '[0-9a-zA-Z]*[0-9a-zA-Z]' ) -for dot in $dots; do - ours="$dot" - underhome=".${dot#dot/}" +for ours in $dots; do + underhome=".${ours#dot/}" process_object done +nondots=$( find home -mindepth 1 -maxdepth 1 -name '[0-9a-zA-Z]*[0-9a-zA-Z]' ) + +for ours in $nondots; do + underhome="${ours#home/}" + process_object +done + +exec 3