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
259 rm -rf ${tmp}/bacula-restore.$$
262 grep "Restore OK" tmp/RUN_$J > /dev/null && \
263 grep "${cwd}/build/po/fr.po.old" tmp/RUN_$J > /dev/null
266 [ "$debug" = 1 ] && echo $J ok
273 grep "Restore OK" tmp/RUN_$J > /dev/null && \
274 grep "${cwd}/build/po/fr.po.old" tmp/RUN_$J > /dev/null
277 [ "$debug" = 1 ] && echo $J ok
285 grep "Restore OK" tmp/RUN_$J > /dev/null && \
286 grep "/etc/passwd.old" tmp/RUN_$J > /dev/null && \
287 grep "Where: *tmp/bacula-restore-it" tmp/RUN_$J > /dev/null && \
288 grep "${cwd}/build/po/fr.po.old" tmp/RUN_$J > /dev/null
291 [ "$debug" = 1 ] && echo $J ok
299 find ${cwd}/build > tmp/list
300 # thanks to BSD like system for that...
301 sed -e 's/[Rr][Ee][Aa][Dd][Mm][Ee]/readme/' -e 's/\([ch]\)$/.old.\1/' tmp/list > tmp/list.sed
302 ./build/src/tools/bregtest -s -f tmp/list -e '/readme/readme/i,/([ch])$/.old.$1/' > tmp/list.bsed
304 diff tmp/list.bsed tmp/list.sed >/dev/null 2>&1
307 [ "$debug" = 1 ] && echo bregtest ok
309 echo "bregtest test in error"