Commit | Line | Data |
---|---|---|
12865a97 WD |
1 | #! /bin/sh |
2 | ||
3 | # Copyright (C) 2004 by Wayne Davison <wayned@samba.org> | |
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 | ||
7892e5ac | 10 | . "$suitedir/rsync.fns" |
12865a97 | 11 | |
12865a97 WD |
12 | # Build some files/dirs/links to copy |
13 | ||
10813368 WD |
14 | # Use local dirnames to better exercise the arg-parsing code. |
15 | cd "$tmpdir" | |
16 | ||
e911ff75 | 17 | mkdir from1 from2 from3 deep |
10813368 WD |
18 | mkdir from2/sub1 from3/sub1 |
19 | mkdir from3/sub2 from1/dir-and-not-dir | |
e911ff75 | 20 | mkdir chk chk/sub1 chk/sub2 chk/dir-and-not-dir |
10813368 WD |
21 | echo "one" >from1/one |
22 | cp -p from1/one from2/one | |
23 | cp -p 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 -p 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 | |
e911ff75 WD |
36 | echo "arg-test" >deep/arg-test |
37 | echo "shallow" >shallow | |
10813368 WD |
38 | |
39 | cp -p from1/one from1/two from2/three from3/four from1/five from3/six chk | |
e911ff75 | 40 | cp -p deep/arg-test shallow chk |
10813368 WD |
41 | cp -p from1/dir-and-not-dir/inside chk/dir-and-not-dir |
42 | cp -p from2/sub1/uno from3/sub1/dos from2/sub1/tres chk/sub1 | |
43 | cp -p from3/sub2/subby chk/sub2 | |
12865a97 | 44 | |
bf10faa9 WD |
45 | # Make sure that time has moved on. |
46 | sleep 1 | |
47 | ||
284d628a | 48 | # Get rid of any directory-time differences |
10813368 WD |
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/ | |
12865a97 | 53 | |
565a340b | 54 | checkit "$RSYNC -avv deep/arg-test shallow from1/ from2/ from3/ to/" chk to |
12865a97 | 55 | |
05118158 | 56 | # The script would have aborted on error, so getting here means we've won. |
12865a97 | 57 | exit 0 |