]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/backup-acl-test
026ff31009d3dd468cfac26361b81e9175dcee40
[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/" >> $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 -v rulez $d/other
42
43 (cd $cwd/build; getfacl -R acl > $cwd/tmp/org)
44
45 change_jobname Client1 $JobName
46 start_test
47
48 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
49 @output /dev/null
50 messages
51 @$out ${cwd}/tmp/log1.out
52 label volume=TestVolume001 storage=File pool=Default
53 run job=$JobName yes
54 wait
55 messages
56 @# 
57 @# now do a restore
58 @#
59 @$out ${cwd}/tmp/log2.out  
60 restore where=${cwd}/tmp/bacula-restores select all done
61 yes
62 wait
63 messages
64 @$out
65 quit
66 END_OF_DATA
67
68 run_bacula
69 check_for_zombie_jobs storage=File
70 stop_bacula
71
72 (cd $cwd/tmp/bacula-restores/$cwd/build; getfacl -R acl > $cwd/tmp/new)
73
74 diff $cwd/tmp/org $cwd/tmp/new
75 if [ $? -ne 0 ]; then
76    rstat=1
77 fi
78
79 check_two_logs
80 check_restore_diff
81
82 end_test