~ubuntu-branches/ubuntu/lucid/rsync/lucid

« back to all changes in this revision

Viewing changes to testsuite/chown.test

  • Committer: Bazaar Package Importer
  • Author(s): Soren Hansen
  • Date: 2008-05-16 11:48:01 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080516114801-8fst7axz33g63wxk
Tags: 3.0.2-2ubuntu1
* Merge from debian unstable, remaining changes:
  - Remove stop links from rc0 and rc6 
    (and use update-rc.d multiuser instead of defaults). (TearDown spec)
  - depend on sysv-rc to accomodate the TearDown changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
 
14
14
. "$suitedir/rsync.fns"
15
15
 
16
 
case `id -u` in
17
 
'') ;; # If "id" failed, try to continue...
18
 
0)  ;;
19
 
*)  if [ -f /usr/bin/fakeroot ]; then
20
 
        echo "Let's try re-running the script under fakeroot..."
21
 
        exec /usr/bin/fakeroot /bin/sh "$0"
22
 
    fi
 
16
case $0 in
 
17
*fake*)
 
18
    $RSYNC --version | grep ", xattrs" >/dev/null || test_skipped "Rsync needs xattrs for fake device tests"
 
19
    RSYNC="$RSYNC --fake-super"
 
20
    TLS_ARGS=--fake-super
 
21
    case "`xattr 2>&1`" in
 
22
    *--list:*)
 
23
        chown() {
 
24
            own=$1
 
25
            shift
 
26
            xattr -s 'rsync.%stat' "100644 0,0 $own" "${@}"
 
27
        }
 
28
        ;;
 
29
    *)
 
30
        chown() {
 
31
            own=$1
 
32
            shift
 
33
            setfattr -n 'user.rsync.%stat' -v "100644 0,0 $own" "${@}"
 
34
        }
 
35
        ;;
 
36
    esac
 
37
    ;;
 
38
*)
 
39
    RSYNC="$RSYNC --super"
 
40
    case `id -u` in
 
41
    '') ;; # If "id" failed, try to continue...
 
42
    0)  ;;
 
43
    *)  if [ -f /usr/bin/fakeroot ]; then
 
44
            echo "Let's try re-running the script under fakeroot..."
 
45
            exec /usr/bin/fakeroot /bin/sh "$0"
 
46
        fi
 
47
        ;;
 
48
    esac
23
49
    ;;
24
50
esac
25
51
 
31
57
echo "This is the file" > "$name1"
32
58
echo "This is the other file" > "$name2"
33
59
 
34
 
chown 5000 "$name1" || test_skipped "Can't chown (probably need root)"
35
 
chown 5001 "$name2" || test_skipped "Can't chown (probably need root)"
36
 
chgrp 5002 "$name1" || test_skipped "Can't chgrp (probably need root)"
37
 
chgrp 5003 "$name2" || test_skipped "Can't chgrp (probably need root)"
 
60
chown 5000:5002 "$name1" || test_skipped "Can't chown (probably need root)"
 
61
chown 5001:5003 "$name2" || test_skipped "Can't chown (probably need root)"
38
62
 
39
 
checkit "$RSYNC -aHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
 
63
cd "$fromdir/.."
 
64
checkit "$RSYNC -aHvv from/ to/" "$fromdir" "$todir"
40
65
 
41
66
# The script would have aborted on error, so getting here means we've won.
42
67
exit 0