# Zap out any schedule in default conf file so that
# it doesn't start during our test
#
-outf="tmp/sed_tmp"
+outf="${tmp}/sed_tmp"
echo "s% Schedule =%# Schedule =%g" >${outf}
echo "s%File Retention =%File Retention = 2 #%" >> ${outf}
-cp ${cwd}/bin/bacula-dir.conf ${cwd}/tmp/1
-sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf
+cp ${scripts}/bacula-dir.conf ${tmp}/1
+sed -f ${outf} ${tmp}/1 >${scripts}/bacula-dir.conf
-change_jobname Client1 $JobName
+change_jobname BackupClient1 $JobName
start_test
-cat <<END_OF_DATA >${cwd}/tmp/bconcmds
-@output /dev/null
+cat <<END_OF_DATA >${tmp}/bconcmds
+@$out /dev/null
messages
-@$out ${cwd}/tmp/log1.out
-label volume=TestVolume001 storage=File pool=Default
+@$out ${tmp}/log1.out
+label volume=TestVolume001 storage=File pool=File
run job=$JobName yes
wait
messages
@#
@# now do a restore
@#
-@$out ${cwd}/tmp/log2.out
-restore where=${cwd}/tmp/bacula-restores
+@$out ${tmp}/log2.out
+restore where=${tmp}/bacula-restores
5
no
README
yes
wait
messages
-@$out
quit
END_OF_DATA
check_for_zombie_jobs storage=File
stop_bacula
-COUNT_OTHER=`find ${cwd}/tmp/bacula-restores -type f | grep -v README | wc -l`
-COUNT_README=`find ${cwd}/tmp/bacula-restores -type f | grep README | wc -l`
+#
+# The above restore should have restored some directories, but only
+# files that have README in their name. There should in fact, be
+# no other files restored COUNT_OTHER==0 and 13 README files restored.
+# We complain if there are less than 11
+#
+COUNT_OTHER=`find ${tmp}/bacula-restores -type f | grep -v README | wc -l`
+COUNT_README=`find ${tmp}/bacula-restores -type f | grep README | wc -l`
-if [ $COUNT_OTHER -gt 0 -o $COUNT_README -lt 15 ]; then
+if [ $COUNT_OTHER -gt 0 -o $COUNT_README -lt 11 ]; then
print_debug "Found non matching files"
- print_debug `find ${cwd}/tmp/bacula-restores -type f | grep -v README`
+ print debug "Count_other=$COUNT_OTHER count_readme=$COUNT_README"
+ print_debug `find ${tmp}/bacula-restores -type f | grep -v README`
rstat=2
fi
#check_two_logs # don't work because of "warning file count mismatch"
-grep "Backup OK" ${cwd}/tmp/log1.out > /dev/null
+grep "Backup OK" ${tmp}/log1.out > /dev/null
if [ $? -ne 0 ]; then
print_debug "Found error on backup"
bstat=2