File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / rsync / testsuite / acls.test
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Oct 14 07:51:15 2013 UTC (10 years, 8 months ago) by misho
Branches: rsync, MAIN
CVS tags: v3_1_2p5, RSYNC3_1_0, HEAD
v 3.1.0

    1: #! /bin/sh
    2: 
    3: # This program is distributable under the terms of the GNU GPL (see
    4: # COPYING).
    5: 
    6: # Test that rsync handles basic ACL preservation.
    7: 
    8: . $suitedir/rsync.fns
    9: 
   10: $RSYNC --version | grep ", ACLs" >/dev/null || test_skipped "Rsync is configured without ACL support"
   11: 
   12: makepath "$fromdir/foo"
   13: echo something >"$fromdir/file1"
   14: echo else >"$fromdir/file2"
   15: 
   16: files='foo file1 file2'
   17: 
   18: case "$setfacl_nodef" in
   19: true)
   20:     if ! chmod --help 2>&1 | fgrep +a >/dev/null; then
   21: 	test_skipped "I don't know how to use setfacl or chmod for ACLs"
   22:     fi
   23:     chmod +a "root allow read,write,execute" "$fromdir/foo" || test_skipped "Your filesystem has ACLs disabled"
   24:     chmod +a "root allow read,execute" "$fromdir/file1"
   25:     chmod +a "admin allow read" "$fromdir/file1"
   26:     chmod +a "daemon allow read,write" "$fromdir/file1"
   27:     chmod +a "root allow read,execute" "$fromdir/file2"
   28: 
   29:     see_acls() {
   30: 	ls -le "${@}"
   31:     }
   32:     ;;
   33: *)
   34:     setfacl -m u:0:7 "$fromdir/foo" || test_skipped "Your filesystem has ACLs disabled"
   35:     setfacl -m g:1:5 "$fromdir/foo"
   36:     setfacl -m g:2:1 "$fromdir/foo"
   37:     setfacl -m g:0:7 "$fromdir/foo"
   38:     setfacl -m u:2:1 "$fromdir/foo"
   39:     setfacl -m u:1:5 "$fromdir/foo"
   40: 
   41:     setfacl -m u:0:5 "$fromdir/file1"
   42:     setfacl -m g:0:4 "$fromdir/file1"
   43:     setfacl -m u:1:6 "$fromdir/file1"
   44: 
   45:     setfacl -m u:0:5 "$fromdir/file2"
   46: 
   47:     see_acls() {
   48: 	getfacl "${@}"
   49:     }
   50:     ;;
   51: esac
   52: 
   53: cd "$fromdir"
   54: $RSYNC -avvA $files "$todir/"
   55: 
   56: see_acls $files >"$scratchdir/acls.txt"
   57: 
   58: cd "$todir"
   59: see_acls $files | diff $diffopt "$scratchdir/acls.txt" -
   60: 
   61: # The script would have aborted on error, so getting here means we've won.
   62: exit 0

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>