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
16 echo "${cwd}/build/po" >tmp/file-list
20 cat <<END_OF_DATA >tmp/bconcmds
23 label volume=TestVolume001
27 @##################################
38 @##################################
49 @##################################
60 @##################################
71 @##################################
82 @##################################
93 @##################################
95 restore strip_prefix="${cwd}" add_prefix="/tmp/bacula-restore"
104 @##################################
106 restore add_suffix=.old
115 @##################################
117 restore regexwhere="!Po!old!i,!old!po!,!\$!.old!"
126 @##################################
135 @## File Relocation -> add suffix -> test -> accept
146 tmp/bacula-restore-it
173 if grep -q "Restore OK" tmp/RUN_$J &&
174 grep -q "${cwd}/build/po/fr.old.po" tmp/RUN_$J
176 [ "$debug" = 1 ] && echo $J ok
184 if grep -q "Restore OK" tmp/RUN_$J &&
185 grep -q "tmp/bacula-restore${cwd}/po/fr.po.old" tmp/RUN_$J
187 [ "$debug" = 1 ] && echo $J ok
194 if grep -q "Restore OK" tmp/RUN_$J &&
195 grep -q "tmp/bacula-restore${cwd}/build/po/fr.po" tmp/RUN_$J
197 [ "$debug" = 1 ] && echo $J ok
204 if grep -q "Restore Error" tmp/RUN_$J
206 [ "$debug" = 1 ] && echo $J ok
213 if grep -q "Restore OK" tmp/RUN_$J &&
214 grep -q "${cwd}/tmp/fr.po" tmp/RUN_$J
216 [ "$debug" = 1 ] && echo $J ok
223 if grep -q "Restore OK" tmp/RUN_$J &&
224 grep -q "${cwd}/build/po/fr.po" tmp/RUN_$J
226 [ "$debug" = 1 ] && echo $J ok
233 if grep -q "Restore OK" tmp/RUN_$J &&
234 grep -q "tmp/bacula-restore/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 "${cwd}/build/po/fr.po.old" 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
264 if grep -q "Restore OK" tmp/RUN_$J &&
265 grep -q "/etc/passwd.old" tmp/RUN_$J &&
266 grep -q -e "Where: *tmp/bacula-restore-it" tmp/RUN_$J &&
267 grep -q "${cwd}/build/po/fr.po.old" tmp/RUN_$J
269 [ "$debug" = 1 ] && echo $J ok
277 find ${cwd}/build > tmp/list
278 # thanks to BSD like system for that...
279 sed -e 's/[Rr][Ee][Aa][Dd][Mm][Ee]/readme/' -e 's/\([ch]\)$/.old.\1/' tmp/list > tmp/list.sed
280 ./build/src/tools/bregtest -s -f tmp/list -e '/readme/readme/i,/([ch])$/.old.$1/' > tmp/list.bsed
282 if diff tmp/list.bsed tmp/list.sed >/dev/null 2>&1
284 [ "$debug" = 1 ] && echo bregtest ok
286 echo "bregtest test in error"