]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/acl-xattr-test
Update regress .gitignore
[bacula/bacula] / regress / tests / acl-xattr-test
1 #!/bin/sh
2 #
3 # Run a backup of the Bacula build directory with some acls
4 #   then restore it.
5 #
6 # The fs have to be mount with the acl option (mount -o remount,acl,user_xattr /tmp)
7 # on ubuntu, it needs the attr package
8 #
9 # For this script to work, you will also need a number of acl packages loaded
10 #   not default on Debian derivatives: 
11 #   apt-get install acl libacl1 libacl1-dev attr
12 #
13 TestName="backup-acl-test"
14 JobName=backup
15 . scripts/functions
16
17 require_linux
18 scripts/cleanup
19 scripts/copy-confs
20
21 #
22 # Zap out any schedule in default conf file so that
23 #  it doesn't start during our test
24 #
25 outf="tmp/sed_tmp"
26 echo "s%  Schedule =%# Schedule =%g" > $outf
27 echo "s/Options {/Options { aclsupport=yes; xattrsupport = yes/" >> $outf
28 cp ${cwd}/bin/bacula-dir.conf  $cwd/tmp/1
29 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf
30
31 d=${cwd}/build/acl
32
33 uid=`id -u`
34 rm -rf $d
35 mkdir $d
36 mkdir $d/testdir
37 cp ${cwd}/bin/bconsole $d
38 setfacl -m d:user:$uid:r-x $d/testdir
39 setfacl -m d:user:root:-wx $d/testdir
40 setfacl -m user:nobody:--- $d/testdir
41 setfacl -m user:nobody:--- $d/bconsole
42 setfacl -m group:nogroup:--x $d/bconsole
43 cp ${cwd}/bin/bconsole $d/testdir
44 cp ${cwd}/bin/bconsole $d/other
45 setfattr -n bacula.test -v rulez $d/other
46
47 ( cd $cwd/build
48   getfacl -R acl > $cwd/tmp/org
49   getfattr -R acl > $cwd/tmp/attr.org
50 )
51
52 change_jobname BackupClient1 $JobName
53 start_test
54
55 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
56 @output /dev/null
57 messages
58 @$out ${cwd}/tmp/log1.out
59 label volume=TestVolume001 storage=File pool=Default
60 setdebug level=400 trace=1 client
61 setdebug level=300 trace=1 director
62 setdebug level=300 trace=1 storage
63 run job=$JobName yes
64 wait
65 messages
66 @# 
67 @# now do a restore
68 @#
69 @$out ${cwd}/tmp/log2.out  
70 restore where=${cwd}/tmp/bacula-restores select all done
71 yes
72 wait
73 messages
74 @$out
75 quit
76 END_OF_DATA
77
78 run_bacula
79 check_for_zombie_jobs storage=File
80 stop_bacula
81
82 ( cd $cwd/tmp/bacula-restores/$cwd/build
83   getfacl -R acl > $cwd/tmp/new
84   getfattr -R acl > $cwd/tmp/attr.new
85 )
86
87 diff $cwd/tmp/org $cwd/tmp/new
88 if [ $? -ne 0 ]; then
89    rstat=1
90 fi
91
92 diff $cwd/tmp/attr.org $cwd/tmp/attr.new
93 if [ $? -ne 0 ]; then
94    rstat=1
95 fi
96
97 check_two_logs
98 check_restore_diff
99
100 if [ x$REGRESS_DEBUG != x ]; then
101   rm -rf $d
102 fi
103
104 end_test