| 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 | |
| 10 | . "$suitedir/rsync.fns" |
| 11 | |
| 12 | set -x |
| 13 | |
| 14 | # Build some files/dirs/links to copy |
| 15 | |
| 16 | from1dir="${fromdir}1" |
| 17 | from2dir="${fromdir}2" |
| 18 | from3dir="${fromdir}3" |
| 19 | |
| 20 | mkdir "$from1dir" "$from2dir" "$from3dir" |
| 21 | mkdir "$from2dir"/sub1 "$from3dir"/sub1 |
| 22 | mkdir "$from3dir"/sub2 |
| 23 | mkdir "$chkdir" "$chkdir"/sub1 "$chkdir"/sub2 |
| 24 | echo "one" >"$from1dir"/one |
| 25 | cp -p "$from1dir"/one "$from2dir"/one |
| 26 | cp -p "$from1dir"/one "$from3dir"/one |
| 27 | echo "two" >"$from1dir"/two |
| 28 | echo "three" >"$from2dir"/three |
| 29 | echo "four" >"$from3dir"/four |
| 30 | echo "five" >"$from1dir"/five |
| 31 | echo "six" >"$from3dir"/six |
| 32 | echo "sub1" >"$from2dir"/sub1/uno |
| 33 | cp -p "$from2dir"/sub1/uno "$from3dir"/sub1/uno |
| 34 | echo "sub2" >"$from3dir"/sub1/dos |
| 35 | echo "sub3" >"$from2dir"/sub1/tres |
| 36 | echo "subby" >"$from3dir"/sub2/subby |
| 37 | |
| 38 | cp -p "$from1dir"/one "$from1dir"/two "$from2dir"/three "$from3dir"/four "$from1dir"/five "$from3dir"/six "$chkdir" |
| 39 | cp -p "$from2dir"/sub1/uno "$from3dir"/sub1/dos "$from2dir"/sub1/tres "$chkdir"/sub1 |
| 40 | cp -p "$from3dir"/sub2/subby "$chkdir"/sub2 |
| 41 | |
| 42 | # Get rid of any directory-time differences |
| 43 | touch "$from1dir" "$from2dir" "$from3dir" \ |
| 44 | "$from2dir"/sub1 "$from3dir"/sub1 "$from3dir"/sub2 \ |
| 45 | "$chkdir" "$chkdir"/sub1 "$chkdir"/sub2 |
| 46 | |
| 47 | checkit "$RSYNC -aHvv \"$from1dir/\" \"$from2dir/\" \"$from3dir/\" \"$todir/\"" "$chkdir" "$todir" |
| 48 | |
| 49 | # The script would have aborted on error, so getting here means we've won. |
| 50 | exit 0 |