Test the --chmod option.
[rsync/rsync.git] / testsuite / chmod-option.test
... / ...
CommitLineData
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 the --chmod option functions correctly.
9
10. $srcdir/testsuite/rsync.fns
11
12set -x
13
14# Build some files
15
16fromdir="$scratchdir/from"
17todir="$scratchdir/to"
18checkdir="$scratchdir/check"
19
20mkdir "$fromdir"
21name1="$fromdir/name1"
22name2="$fromdir/name2"
23dir1="$fromdir/dir1"
24dir2="$fromdir/dir2"
25echo "This is the file" > "$name1"
26echo "This is the other file" > "$name2"
27mkdir "$dir1" "$dir2"
28
29chmod 4700 "$name1" || test_skipped "Can't chmod"
30chmod 700 "$dir1"
31chmod 770 "$dir2"
32
33# Copy the files we've created over to another directory
34checkit "$RSYNC -avv \"$fromdir/\" \"$checkdir/\"" "$fromdir" "$checkdir"
35
36# And then manually make the changes which should occur
37umask 002
38chmod ug-s,a+rX "$checkdir"/*
39chmod +w "$checkdir" "$checkdir"/dir*
40
41checkit "$RSYNC -avv --chmod ug-s,a+rX,D+w \"$fromdir/\" \"$todir/\"" "$checkdir" "$todir"
42
43# The script would have aborted on error, so getting here means we've won.
44exit 0