| 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 | # Test that the --backup option works right. |
| 9 | |
| 10 | . "$suitedir/rsync.fns" |
| 11 | |
| 12 | bakdir="$tmpdir/chk" |
| 13 | |
| 14 | mkdir "$fromdir" "$bakdir" |
| 15 | name1="$fromdir/name1" |
| 16 | name2="$fromdir/name2" |
| 17 | echo "This is the file" > "$name1" |
| 18 | echo "This is the other file" > "$name2" |
| 19 | |
| 20 | checkit "$RSYNC -avv --backup --backup-dir=\"$bakdir\" \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir" |
| 21 | |
| 22 | $RSYNC -avv --backup "$todir/" "$chkdir/" |
| 23 | |
| 24 | echo "Extending the file" >> "$name1" |
| 25 | echo "Extending the other file" >> "$name2" |
| 26 | |
| 27 | checkit "$RSYNC -avv --backup --backup-dir=\"$bakdir\" \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir" |
| 28 | |
| 29 | diff -ru "$chkdir" "$bakdir" |
| 30 | |
| 31 | echo "Extending the file again" >> "$name1" |
| 32 | echo "Extending the other file again" >> "$name2" |
| 33 | |
| 34 | checkit "$RSYNC -avv --inplace --backup --backup-dir=\"$bakdir\" \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir" |
| 35 | |
| 36 | diff -ru "$chkdir" "$bakdir" |
| 37 | |
| 38 | # The script would have aborted on error, so getting here means we've won. |
| 39 | exit 0 |