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 grep "Restore OK" tmp/RUN_$J > /dev/null && \
184 grep "${cwd}/build/po/fr.old.po" tmp/RUN_$J > /dev/null
188 [ "$debug" = 1 ] && echo $J ok
195 grep "Restore OK" tmp/RUN_$J > /dev/null && \
196 grep "tmp/bacula-restore${cwd}/po/fr.po.old" tmp/RUN_$J > /dev/null
200 [ "$debug" = 1 ] && echo $J ok
207 grep "Restore OK" tmp/RUN_$J > /dev/null && \
208 grep "tmp/bacula-restore${cwd}/build/po/fr.po" tmp/RUN_$J > /dev/null
211 [ "$debug" = 1 ] && echo $J ok
218 grep "Restore Error" tmp/RUN_$J > /dev/null
221 [ "$debug" = 1 ] && echo $J ok
228 grep "Restore OK" tmp/RUN_$J > /dev/null && \
229 grep "${cwd}/tmp/fr.po" tmp/RUN_$J > /dev/null
232 [ "$debug" = 1 ] && echo $J ok
239 grep "Restore OK" tmp/RUN_$J > /dev/null && \
240 grep "${cwd}/build/po/fr.po" tmp/RUN_$J > /dev/null
243 [ "$debug" = 1 ] && echo $J ok
250 grep "Restore OK" tmp/RUN_$J > /dev/null && \
251 grep "tmp/bacula-restore/build/po/fr.po" tmp/RUN_$J > /dev/null
254 [ "$debug" = 1 ] && echo $J ok
261 grep -q "Restore OK" tmp/RUN_$J > /dev/null && \
262 grep -q "${cwd}/build/po/fr.po.old" tmp/RUN_$J > /dev/null
265 [ "$debug" = 1 ] && echo $J ok
272 grep "Restore OK" tmp/RUN_$J > /dev/null && \
273 grep "${cwd}/build/po/fr.po.old" tmp/RUN_$J > /dev/null
276 [ "$debug" = 1 ] && echo $J ok
284 grep "Restore OK" tmp/RUN_$J > /dev/null && \
285 grep "/etc/passwd.old" tmp/RUN_$J > /dev/null && \
286 grep "Where: *tmp/bacula-restore-it" tmp/RUN_$J > /dev/null && \
287 grep "${cwd}/build/po/fr.po.old" tmp/RUN_$J > /dev/null
290 [ "$debug" = 1 ] && echo $J ok
298 find ${cwd}/build > tmp/list
299 # thanks to BSD like system for that...
300 sed -e 's/[Rr][Ee][Aa][Dd][Mm][Ee]/readme/' -e 's/\([ch]\)$/.old.\1/' tmp/list > tmp/list.sed
301 ./build/src/tools/bregtest -s -f tmp/list -e '/readme/readme/i,/([ch])$/.old.$1/' > tmp/list.bsed
303 diff tmp/list.bsed tmp/list.sed >/dev/null 2>&1
306 [ "$debug" = 1 ] && echo bregtest ok
308 echo "bregtest test in error"