maint: update quoting of "Try `prog --help'" to "Try 'prog --help'"
[coreutils.git] / tests / mv / acl
blob382752a338a8f18094207f9024f2aa087edfc51a
1 #!/bin/sh
2 # move files/directories across file system boundaries
3 # and make sure acls are preserved
5 # Copyright (C) 2005-2012 Free Software Foundation, Inc.
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 . "${srcdir=.}/init.sh"; path_prepend_ ../src
21 print_ver_ mv getfacl setfacl
23 require_acl_
25 # Skip this test if cp was built without ACL support:
26 grep '^#define USE_ACL 1' $CONFIG_HEADER > /dev/null ||
27 skip_ "insufficient ACL support"
29 cleanup_() { rm -rf "$other_partition_tmpdir"; }
30 . "$abs_srcdir/other-fs-tmpdir"
32 touch file || framework_failure_
33 t1=$other_partition_tmpdir/t1
34 touch $t1 || framework_failure_
36 skip_partition=none
37 # Ensure that setfacl and getfacl work on this file system.
38 setfacl -m user:bin:rw- file 2> /dev/null || skip_partition=.
39 # And on the destination file system.
40 setfacl -m user:bin:rw- $t1 || skip_partition=$other_partition_tmpdir
41 acl1=`getfacl file` || skip_partition=.
43 test $skip_partition != none &&
44 skip_ "'$skip_partition' is not on a suitable file system for this test"
46 # move the access acl of a file
47 mv file "$other_partition_tmpdir" || fail=1
48 acl2=`cd "$other_partition_tmpdir" && getfacl file` || framework_failure_
49 test "$acl1" = "$acl2" || fail=1
51 # move the access acl of a directory
52 mkdir dir || framework_failure_
53 setfacl -m user:bin:rw- dir || framework_failure_
54 acl1=`getfacl dir` || framework_failure_
55 mv dir "$other_partition_tmpdir" || fail=1
56 acl2=`cd "$other_partition_tmpdir" && getfacl dir` || framework_failure_
57 test "$acl1" = "$acl2" || fail=1
59 # move the default acl of a directory
60 mkdir dir2 || framework_failure_
61 setfacl -d -m user:bin:rw- dir2 || framework_failure_
62 acl1=`getfacl dir2` || framework_failure_
63 mv dir2 "$other_partition_tmpdir" || fail=1
64 acl2=`cd "$other_partition_tmpdir" && getfacl dir2` || framework_failure_
65 test "$acl1" = "$acl2" || fail=1
67 Exit $fail