3 # Test file relocation feature
6 TestName="regexwhere-test"
13 rm -f bin/bacula-dir.conf
15 rm -f ${cwd}/build/po/*old*
17 /bin/cp -f scripts/bacula-dir.conf.regexwhere bin/bacula-dir.conf
19 echo "${cwd}/build/po" >/tmp/file-list
23 cat <<END_OF_DATA >tmp/bconcmds
26 label volume=TestVolume001
30 @##################################
41 @##################################
52 @##################################
63 @##################################
74 @##################################
85 @##################################
96 @##################################
98 restore strip_prefix="${cwd}" add_prefix="/tmp/bacula-restore"
107 @##################################
109 restore add_suffix=.old
118 @##################################
120 restore regexwhere="!Po!old!i,!old!po!,!\$!.old!"
129 @##################################
138 @## File Relocation -> add suffix -> test -> accept
149 /tmp/bacula-restore-it
165 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf > /dev/null
177 if grep -q "Restore OK" tmp/RUN_$J &&
178 grep -q "${cwd}/build/po/fr.old.po" tmp/RUN_$J
180 [ "$debug" = 1 ] && echo $J ok
188 if grep -q "Restore OK" tmp/RUN_$J &&
189 grep -q "/tmp/bacula-restore${cwd}/po/fr.po.old" tmp/RUN_$J
191 [ "$debug" = 1 ] && echo $J ok
198 if grep -q "Restore OK" tmp/RUN_$J &&
199 grep -q "/tmp/bacula-restore${cwd}/build/po/fr.po" tmp/RUN_$J
201 [ "$debug" = 1 ] && echo $J ok
208 if grep -q "Restore Error" tmp/RUN_$J
210 [ "$debug" = 1 ] && echo $J ok
217 if grep -q "Restore OK" tmp/RUN_$J &&
218 grep -q "${cwd}/tmp/fr.po" tmp/RUN_$J
220 [ "$debug" = 1 ] && echo $J ok
227 if grep -q "Restore OK" tmp/RUN_$J &&
228 grep -q "${cwd}/build/po/fr.po" tmp/RUN_$J
230 [ "$debug" = 1 ] && echo $J ok
237 if grep -q "Restore OK" tmp/RUN_$J &&
238 grep -q "/tmp/bacula-restore/build/po/fr.po" tmp/RUN_$J
240 [ "$debug" = 1 ] && echo $J ok
247 if grep -q "Restore OK" tmp/RUN_$J &&
248 grep -q "${cwd}/build/po/fr.po.old" tmp/RUN_$J
250 [ "$debug" = 1 ] && echo $J ok
257 if grep -q "Restore OK" tmp/RUN_$J &&
258 grep -q "${cwd}/build/po/fr.po.old" tmp/RUN_$J
260 [ "$debug" = 1 ] && echo $J ok
268 if grep -q "Restore OK" tmp/RUN_$J &&
269 grep -q "/etc/passwd.old" tmp/RUN_$J &&
270 grep -q -e "Where: */tmp/bacula-restore-it" tmp/RUN_$J &&
271 grep -q "${cwd}/build/po/fr.po.old" tmp/RUN_$J
273 [ "$debug" = 1 ] && echo $J ok
281 find ${cwd}/build > tmp/list
282 # thanks to BSD like system for that...
283 sed -e 's/[Rr][Ee][Aa][Dd][Mm][Ee]/readme/' -e 's/\([ch]\)$/.old.\1/' tmp/list > tmp/list.sed
284 ./build/src/tools/bregtest -s -f tmp/list -e '/readme/readme/i,/([ch])$/.old.$1/' > tmp/list.bsed
286 if diff tmp/list.bsed tmp/list.sed >/dev/null 2>&1
288 [ "$debug" = 1 ] && echo bregtest ok
290 echo "bregtest test in error"