3 # Copyright (C) 2000-2017 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
7 # Run a simple backup of the Bacula build directory then create some
8 # new files, do an Incremental and restore those two files.
9 # test the bvfs interface
11 TestName="bvfs-acl-test"
16 ${rscripts}/copy-test-confs
17 echo "${tmpsrc}" >${tmp}/file-list
18 echo "${cwd}/build" >> ${tmp}/file-list
21 cp -p ${src}/src/dird/*.c ${tmpsrc}
23 echo "${tmpsrc}/ficheriro1.txt" >restore-list
24 echo "${tmpsrc}/ficheriro2.txt" >>restore-list
28 $bperl -e "print get_resource('$conf/bacula-dir.conf', 'Client', '$HOST-fd')" | sed "s/$HOST-fd/$HOST-fd2/" >> $conf/bacula-dir.conf
29 $bperl -e "print get_resource('$conf/bacula-dir.conf', 'Client', '$HOST-fd')" | sed "s/$HOST-fd/$HOST-fd3/" >> $conf/bacula-dir.conf
31 cat <<EOF >> $conf/bacula-dir.conf
33 Name = restricted-user
35 JobACL = NightlySave, $JobName
38 FileSetACL = CompressedSet
40 CommandACL = show, .jobs, messages, .pool, .storage, .client, .fileset, .bvfs_get_jobids, .bvfs_restore, .bvfs_lsdirs, .bvfs_update, reload, quit, .bvfs_lsfiles
46 cp $conf/bconsole.conf $conf/bconsole.conf.2
48 cat <<EOF >> $conf/bconsole.conf.2
50 Name = restricted-user
55 change_jobname CompressedTest $JobName
58 cat <<END_OF_DATA >${tmp}/bconcmds
62 label storage=File volume=TestVolume001
63 label storage=File volume=TestVolume00
64 run job=$JobName client=$HOST-fd yes
67 run job=$JobName client=$HOST-fd2 yes
70 run job=$JobName client=$HOST-fd3 yes
73 run job=NightlySave client=$HOST-fd yes
76 @exec "touch ${tmpsrc}/fic1"
77 run job=$JobName client=$HOST-fd2 yes
80 run job=$JobName client=$HOST-fd3 yes
83 run job=$JobName client=$HOST-fd yes
86 run job=NightlySave client=$HOST-fd yes
91 .bvfs_get_jobids client=$HOST-fd
96 check_for_zombie_jobs storage=File $HOST-fd
100 .bvfs_get_jobids client=$HOST-fd
101 .bvfs_lsfiles jobid=1 path=${tmpsrc}/ filename=dird_conf.c
103 .bvfs_get_jobids client=$HOST-fd2
104 .bvfs_lsfiles jobid=2 path=${tmpsrc}/ filename=dird_conf.c
106 .bvfs_get_jobids client=$HOST-fd3
107 .bvfs_lsfiles jobid=3 path=${tmpsrc}/ filename=dird_conf.c
110 cat <<END_OF_DATA >${tmp}/bconcmds
114 $bin/bconsole -c $conf/bconsole.conf.2 < $tmp/cmd
116 sed -i "s/out1/out2/" $tmp/cmd
117 sed -i "s/ClientACL = $HOST-fd/ClientACL = $HOST-fd2/" $conf/bacula-dir.conf
121 $bin/bconsole -c $conf/bconsole.conf.2 < $tmp/cmd
123 sed -i "s/out2/out3/" $tmp/cmd
124 sed -i "s/ClientACL = $HOST-fd2/ClientACL = $HOST-fd3/" $conf/bacula-dir.conf
128 $bin/bconsole -c $conf/bconsole.conf.2 < $tmp/cmd
132 grep -E "\s1\s.*dird_conf.c" $tmp/out10.log > /dev/null
133 if [ $? -ne 0 ]; then
134 print_debug "ERROR: should find dird_conf.c for jobid 1 in out10.log"
138 grep -E "\s[32]\s.*dird_conf.c" $tmp/out11.log $tmp/out12.log > /dev/null
139 if [ $? -eq 0 ]; then
140 print_debug "ERROR: should not find dird_conf.c for jobid 2 or 3 in out10.log or out11.log"
144 grep -E "\s2\s.*dird_conf.c" $tmp/out21.log > /dev/null
145 if [ $? -ne 0 ]; then
146 print_debug "ERROR: should find dird_conf.c for jobid 2 in out21.log"
150 grep -E "\s[31]\s.*dird_conf.c" $tmp/out20.log $tmp/out22.log > /dev/null
151 if [ $? -eq 0 ]; then
152 print_debug "ERROR: should not find dird_conf.c for jobid 3 or 1 in out20.log or out22.log"
156 grep -E "\s3\s.*dird_conf.c" $tmp/out32.log > /dev/null
157 if [ $? -ne 0 ]; then
158 print_debug "ERROR: should find dird_conf.c for jobid 3 in out32.log"
162 grep -E "\s[21]\s.*dird_conf.c" $tmp/out31.log $tmp/out30.log > /dev/null
163 if [ $? -eq 0 ]; then
164 print_debug "ERROR: should not find dird_conf.c for jobid 2 or 1 in out31.log or out30.log"