chiark / gitweb /
Tidy up another $basepath/$dot
[ian-dotfiles.git] / infra / makelinks
index dd167d31a200fcda856a91e3568a4a79670c275c..f3b051053bd73b2a643e2c09bee83e9695082b07 100755 (executable)
@@ -72,11 +72,7 @@ with_log () {
     "$@"
 }
 
-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/}"
+process_object () {
     inhome="$HOME/$underhome"
     prhome="~/$underhome"
     linktarget="$basepath/$ours"
@@ -86,7 +82,7 @@ for dot in $dots; do
         bad "wrong symlink target"
     elif ! [ -e "$inhome" ]; then
        needs setup "absent here"
-       $act ln -s "$basepath/$dot" "$inhome"
+       $act ln -s "$linktarget" "$inhome"
     elif [ -f "$inhome" ] && [ -f "$ours" ]; then
        if cmp -s "$ours" "$inhome"; then
            needs setup "identical here but not yet symlinked"
@@ -109,6 +105,14 @@ for dot in $dots; do
     else
        bad "mismatched file types"
     fi
+}
+
+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/}"
+    process_object
 done
 
 brokens=$(