Commit | Line | Data |
---|---|---|
b0d4f4c1 MP |
1 | #! /bin/sh |
2 | ||
3 | # Copyright (C) 2002 by Martin Pool <mbp@samba.org> | |
4 | ||
5 | # This program is distributable under the terms of the GNU GPL (see | |
6 | # COPYING). | |
7 | ||
8 | # Test that when rsync is running as root and has -a it correctly sets | |
9 | # the ownership of the destination. | |
10 | ||
11 | # We don't know what users will be present on this system, so we just | |
12 | # use random numeric uids and gids. | |
13 | ||
b0e9bafc | 14 | . "$suitedir/rsync.fns" |
b0d4f4c1 | 15 | |
13725744 WD |
16 | set -x |
17 | ||
648859bd WD |
18 | case `id -u` in |
19 | '') ;; # If "id" failed, try to continue... | |
20 | 0) ;; | |
21 | *) if [ -f /usr/bin/fakeroot ]; then | |
bb21ecac | 22 | echo "Let's try re-running the script under fakeroot..." |
648859bd WD |
23 | exec /usr/bin/fakeroot /bin/sh "$0" |
24 | fi | |
25 | ;; | |
26 | esac | |
27 | ||
b0d4f4c1 MP |
28 | # Build some hardlinks |
29 | ||
b0d4f4c1 MP |
30 | mkdir "$fromdir" |
31 | name1="$fromdir/name1" | |
32 | name2="$fromdir/name2" | |
33 | echo "This is the file" > "$name1" | |
34 | echo "This is the other file" > "$name2" | |
35 | ||
79c9d8a1 MP |
36 | chown 5000 "$name1" || test_skipped "Can't chown (probably need root)" |
37 | chown 5001 "$name2" || test_skipped "Can't chown (probably need root)" | |
38 | chgrp 5002 "$name1" || test_skipped "Can't chgrp (probably need root)" | |
39 | chgrp 5003 "$name2" || test_skipped "Can't chgrp (probably need root)" | |
b0d4f4c1 | 40 | |
06464f55 | 41 | checkit "$RSYNC -aHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir" |
b0d4f4c1 | 42 | |
05118158 | 43 | # The script would have aborted on error, so getting here means we've won. |
b0d4f4c1 | 44 | exit 0 |