Add a makepath() function to cope with machines that do not have
authorMartin Pool <mbp@samba.org>
Thu, 6 Sep 2001 05:52:40 +0000 (05:52 +0000)
committerMartin Pool <mbp@samba.org>
Thu, 6 Sep 2001 05:52:40 +0000 (05:52 +0000)
'mkdir -p'.  (Stone knives and bearskins...)

testsuite/rsync.fns

index 369d38c..8dd91a1 100644 (file)
@@ -77,6 +77,30 @@ hands_setup() {
 
 
 
 
 
 
+
+####################
+# Many machines do not have "mkdir -p", so we have to build up long paths.
+# How boring.  
+makepath () {
+    p="$1"
+    (
+       # Absolut Unix.
+       if echo $p | grep '^/' >/dev/null
+       then
+           cd /
+       fi
+    
+       # This will break if $1 contains a space.
+       for c in `echo $p | tr '/' ' '`
+       do 
+           [ -d "$c" ] || mkdir "$c" || return $? 
+           cd "$c" || return $?
+       done
+    )
+}
+
+
+
 ###########################
 # Run a test (in '$1') then compare directories $2 and $3 to see if
 # there are any difference.  If there are, explain them.
 ###########################
 # Run a test (in '$1') then compare directories $2 and $3 to see if
 # there are any difference.  If there are, explain them.