1#! /bin/sh 2 3# Originally by Vladim�r Michl <Vladimir.Michl@hlubocky.del.cz> 4 5. "$suitedir/rsync.fns" 6 7test_symlink() { 8 is_a_link "$1" || test_fail "File $1 is not a symlink" 9}; 10 11test_regular() { 12 if [ ! -f "$1" ]; then 13 test_fail "File $1 is not regular file or not exists"; 14 fi; 15}; 16 17cd "$tmpdir" 18 19mkdir from 20 21mkdir "from/safe" 22mkdir "from/unsafe" 23 24mkdir "from/safe/files" 25mkdir "from/safe/links" 26 27touch "from/safe/files/file1" 28touch "from/safe/files/file2" 29touch "from/unsafe/unsafefile" 30 31ln -s ../files/file1 "from/safe/links/" 32ln -s ../files/file2 "from/safe/links/" 33ln -s ../../unsafe/unsafefile "from/safe/links/" 34 35echo "rsync with relative path and just -a"; 36$RSYNC -avv from/safe/ to 37test_symlink to/links/file1 38test_symlink to/links/file2 39test_symlink to/links/unsafefile 40 41echo "rsync with relative path and -a --copy-links" 42$RSYNC -avv --copy-links from/safe/ to 43test_regular to/links/file1 44test_regular to/links/file2 45test_regular to/links/unsafefile 46 47echo "rsync with relative path and --copy-unsafe-links"; 48$RSYNC -avv --copy-unsafe-links from/safe/ to 49test_symlink to/links/file1 50test_symlink to/links/file2 51test_regular to/links/unsafefile 52 53rm -rf to 54echo "rsync with relative2 path"; 55(cd from; $RSYNC -avv --copy-unsafe-links safe/ ../to) 56test_symlink to/links/file1 57test_symlink to/links/file2 58test_regular to/links/unsafefile 59 60rm -rf to 61echo "rsync with absolute path"; 62$RSYNC -avv --copy-unsafe-links `pwd`/from/safe/ to 63test_symlink to/links/file1 64test_symlink to/links/file2 65test_regular to/links/unsafefile 66 67