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