Add SELinux context store/restore/list support.
[tar.git] / tests / selacl01.at
blob60f106b421b7df836ea7856d6ea256baa80448c4
1 # Process this file with autom4te to create testsuite. -*- Autotest -*-
3 # Test suite for GNU tar.
4 # Copyright (C) 2011 Free Software Foundation, Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3, or (at your option)
9 # any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 # Test description:
21 # This is basic test for support of extended attributes.
23 AT_SETUP([acls/selinux: special files & fifos])
24 AT_KEYWORDS([xattrs selinux acls selacls01])
26 AT_TAR_CHECK([
27 AT_PRIVILEGED_PREREQ
28 AT_XATTRS_UTILS_PREREQ
29 AT_SELINUX_PREREQ
30 AT_ACLS_PREREQ
32 mkdir dir
33 mkfifo dir/fifo
34 MAJOR=$( stat /dev/urandom --printf="%t" )
35 MINOR=$( stat /dev/urandom --printf="%T" )
36 mknod dir/chartype c $MAJOR $MINOR
38 # setup attributes
39 chcon -h --user=system_u dir/fifo
40 chcon -h --user=system_u dir/chartype
41 setfacl -m u:$UID:--- dir/fifo
42 setfacl -m u:$UID:rwx dir/chartype
44 getfacl dir/fifo >> before
45 getfattr -msecurity.selinux dir/chartype >> before
47 tar --xattrs --selinux --acls -cf archive.tar dir
49 mv dir olddir
51 tar --xattrs --selinux --acls -xf archive.tar
53 getfacl dir/fifo >> after
54 getfattr -msecurity.selinux dir/chartype >> after
56 diff before after
57 echo separator
59 [0],
60 [separator
63 AT_CLEANUP