merge.test 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #! /bin/sh
  2. # Copyright (C) 2004 by Wayne Davison <wayned@samba.org>
  3. # This program is distributable under the terms of the GNU GPL (see
  4. # COPYING).
  5. # Make sure we can merge files from multiple directories into one.
  6. . "$suitedir/rsync.fns"
  7. # Build some files/dirs/links to copy
  8. # Use local dirnames to better exercise the arg-parsing code.
  9. cd "$tmpdir"
  10. mkdir from1 from2 from3 deep
  11. mkdir from2/sub1 from3/sub1
  12. mkdir from3/sub2 from1/dir-and-not-dir
  13. mkdir chk chk/sub1 chk/sub2 chk/dir-and-not-dir
  14. echo "one" >from1/one
  15. cp_touch from1/one from2/one
  16. cp_touch from1/one from3/one
  17. echo "two" >from1/two
  18. echo "three" >from2/three
  19. echo "four" >from3/four
  20. echo "five" >from1/five
  21. echo "six" >from3/six
  22. echo "sub1" >from2/sub1/uno
  23. cp_touch from2/sub1/uno from3/sub1/uno
  24. echo "sub2" >from3/sub1/dos
  25. echo "sub3" >from2/sub1/tres
  26. echo "subby" >from3/sub2/subby
  27. echo "extra" >from1/dir-and-not-dir/inside
  28. echo "not-dir" >from3/dir-and-not-dir
  29. echo "arg-test" >deep/arg-test
  30. echo "shallow" >shallow
  31. cp_touch from1/one from1/two from2/three from3/four from1/five from3/six chk
  32. cp_touch deep/arg-test shallow chk
  33. cp_touch from1/dir-and-not-dir/inside chk/dir-and-not-dir
  34. cp_touch from2/sub1/uno from3/sub1/dos from2/sub1/tres chk/sub1
  35. cp_touch from3/sub2/subby chk/sub2
  36. # Make sure that time has moved on.
  37. sleep 1
  38. # Get rid of any directory-time differences
  39. $RSYNC -av --existing -f 'exclude,! */' from1/ from2/
  40. $RSYNC -av --existing -f 'exclude,! */' from2/ from3/
  41. $RSYNC -av --existing -f 'exclude,! */' from1/ chk/
  42. $RSYNC -av --existing -f 'exclude,! */' from3/ chk/
  43. checkit "$RSYNC -avv deep/arg-test shallow from1/ from2/ from3/ to/" "$chkdir" "$todir"
  44. # The script would have aborted on error, so getting here means we've won.
  45. exit 0