]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/backup-acl-test
ebl add debug
[bacula/bacula] / regress / tests / backup-acl-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 TestName="backup-acl-test"
10 JobName=backup
11 . scripts/functions
12
13 require_linux
14 scripts/cleanup
15 scripts/copy-confs
16
17 #
18 # Zap out any schedule in default conf file so that
19 #  it doesn't start during our test
20 #
21 outf="tmp/sed_tmp"
22 echo "s%  Schedule =%# Schedule =%g" > $outf
23 echo "s/Options {/Options { aclsupport=yes; xattrsupport = yes/" >> $outf
24 cp ${cwd}/bin/bacula-dir.conf  $cwd/tmp/1
25 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf
26
27 d=${cwd}/build/acl
28
29 uid=`id -u`
30 rm -rf $d
31 mkdir $d
32 mkdir $d/testdir
33 cp ${cwd}/bin/bconsole $d
34 setfacl -m d:user:$uid:r-x $d/testdir
35 setfacl -m d:user:root:-wx $d/testdir
36 setfacl -m user:nobody:--- $d/testdir
37 setfacl -m user:nobody:--- $d/bconsole
38 setfacl -m group:nogroup:--x $d/bconsole
39 cp ${cwd}/bin/bconsole $d/testdir
40 cp ${cwd}/bin/bconsole $d/other
41 setfattr -n bacula.test -v rulez $d/other
42
43 ( cd $cwd/build
44   getfacl -R acl > $cwd/tmp/org
45   getfattr -R acl > $cwd/tmp/attr.org
46 )
47
48 change_jobname Client1 $JobName
49 start_test
50
51 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
52 @output /dev/null
53 messages
54 @$out ${cwd}/tmp/log1.out
55 label volume=TestVolume001 storage=File pool=Default
56 setdebug level=400 trace=1 client
57 setdebug level=300 trace=1 director
58 setdebug level=300 trace=1 storage
59 run job=$JobName yes
60 wait
61 messages
62 @# 
63 @# now do a restore
64 @#
65 @$out ${cwd}/tmp/log2.out  
66 restore where=${cwd}/tmp/bacula-restores select all done
67 yes
68 wait
69 messages
70 @$out
71 quit
72 END_OF_DATA
73
74 run_bacula
75 check_for_zombie_jobs storage=File
76 stop_bacula
77
78 ( cd $cwd/tmp/bacula-restores/$cwd/build
79   getfacl -R acl > $cwd/tmp/new
80   getfattr -R acl > $cwd/tmp/attr.new
81 )
82
83 diff $cwd/tmp/org $cwd/tmp/new
84 if [ $? -ne 0 ]; then
85    rstat=1
86 fi
87
88 diff $cwd/tmp/attr.org $cwd/tmp/attr.new
89 if [ $? -ne 0 ]; then
90    rstat=1
91 fi
92
93 check_two_logs
94 check_restore_diff
95
96 if [ x$REGRESS_DEBUG != x ]; then
97   rm -rf $d
98 fi
99
100 end_test