3 # Test file relocation feature
6 TestName="regexwhere-test"
12 scripts/copy-test-confs
14 /bin/cp -f scripts/bacula-dir.conf.regexwhere bin/bacula-dir.conf
17 # Remove the !restored from the messages resource because
18 # this test needs the restored listing to verify the
21 outf="${cwd}/tmp/sed_tmp"
22 echo "s%, \!restored%%g" >${outf}
23 cp ${cwd}/bin/bacula-fd.conf ${cwd}/tmp/1
24 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-fd.conf
26 echo "${cwd}/build/po" >tmp/file-list
30 cat <<END_OF_DATA >tmp/bconcmds
33 label volume=TestVolume001
37 @##################################
48 @##################################
59 @##################################
70 @##################################
81 @##################################
92 @##################################
103 @##################################
105 restore strip_prefix="${cwd}" add_prefix="/tmp/bacula-restore"
114 @##################################
116 restore add_suffix=.old
125 @##################################
127 restore regexwhere="!Po!old!i,!old!po!,!\$!.old!"
136 @##################################
145 @## File Relocation -> add suffix -> test -> accept
156 tmp/bacula-restore-it
183 if grep -q "Restore OK" tmp/RUN_$J &&
184 grep -q "${cwd}/build/po/fr.old.po" tmp/RUN_$J
186 [ "$debug" = 1 ] && echo $J ok
194 if grep -q "Restore OK" tmp/RUN_$J &&
195 grep -q "tmp/bacula-restore${cwd}/po/fr.po.old" tmp/RUN_$J
197 [ "$debug" = 1 ] && echo $J ok
204 if grep -q "Restore OK" tmp/RUN_$J &&
205 grep -q "tmp/bacula-restore${cwd}/build/po/fr.po" tmp/RUN_$J
207 [ "$debug" = 1 ] && echo $J ok
214 if grep -q "Restore Error" tmp/RUN_$J
216 [ "$debug" = 1 ] && echo $J ok
223 if grep -q "Restore OK" tmp/RUN_$J &&
224 grep -q "${cwd}/tmp/fr.po" tmp/RUN_$J
226 [ "$debug" = 1 ] && echo $J ok
233 if grep -q "Restore OK" tmp/RUN_$J &&
234 grep -q "${cwd}/build/po/fr.po" tmp/RUN_$J
236 [ "$debug" = 1 ] && echo $J ok
243 if grep -q "Restore OK" tmp/RUN_$J &&
244 grep -q "tmp/bacula-restore/build/po/fr.po" tmp/RUN_$J
246 [ "$debug" = 1 ] && echo $J ok
253 if grep -q "Restore OK" tmp/RUN_$J &&
254 grep -q "${cwd}/build/po/fr.po.old" tmp/RUN_$J
256 [ "$debug" = 1 ] && echo $J ok
263 if grep -q "Restore OK" tmp/RUN_$J &&
264 grep -q "${cwd}/build/po/fr.po.old" tmp/RUN_$J
266 [ "$debug" = 1 ] && echo $J ok
274 if grep -q "Restore OK" tmp/RUN_$J &&
275 grep -q "/etc/passwd.old" tmp/RUN_$J &&
276 grep -q -e "Where: *tmp/bacula-restore-it" tmp/RUN_$J &&
277 grep -q "${cwd}/build/po/fr.po.old" tmp/RUN_$J
279 [ "$debug" = 1 ] && echo $J ok
287 find ${cwd}/build > tmp/list
288 # thanks to BSD like system for that...
289 sed -e 's/[Rr][Ee][Aa][Dd][Mm][Ee]/readme/' -e 's/\([ch]\)$/.old.\1/' tmp/list > tmp/list.sed
290 ./build/src/tools/bregtest -s -f tmp/list -e '/readme/readme/i,/([ch])$/.old.$1/' > tmp/list.bsed
292 if diff tmp/list.bsed tmp/list.sed >/dev/null 2>&1
294 [ "$debug" = 1 ] && echo bregtest ok
296 echo "bregtest test in error"