chiark / gitweb /
Make directories called for by correspondences
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 16 Dec 2015 23:41:26 +0000 (23:41 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 16 Dec 2015 23:41:26 +0000 (23:41 +0000)
infra/makelinks

index e4fa88d..9202944 100755 (executable)
@@ -123,10 +123,27 @@ done
 
 exec 3<correspondences
 while read <&3 ours underhome; do
-      case "$ours" in
-      ''|'#'*) ;;
-      *) process_object ;;
-      esac
+    case "$ours" in
+    ''|'#'*) ;;
+    *)
+       case "$underhome" in
+       */*)
+           parent=${underhome%/*}
+           punderhome="$HOME/$parent"
+           prhome="~/${underhome%/*}"
+           if [ -d "$punderhome" ]; then
+               good "directory exists"
+           elif ! [ -e "$punderhome" ]; then
+               needs install "directory does not exist"
+               $act mkdir -p "$punderhome"
+           else
+               bad "ought to be director but isn't"
+           fi
+           ;;
+       esac
+       process_object
+       ;;
+    esac
 done
 
 brokens=$(