--- /dev/null
+#!/bin/sh
+#
+# Run a simple backup of the Bacula build directory but
+# split the archive into two volumes then bscan it
+# into the catalog after the backup. It also to a limited
+# extent tests the purge volume and delete volume commands.
+#
+cwd=`pwd`
+scripts/copy-test-confs
+scripts/cleanup
+echo "${cwd}/build" >/tmp/file-list
+bin/bacula stop 2>&1 >/dev/null
+bin/drop_sqlite_tables
+bin/make_sqlite_tables
+
+echo " "
+echo " "
+echo " === Starting bscan-test ==="
+echo " === Starting bscan-test ===" >working/log
+echo " "
+
+bin/bacula start
+bin/console -c bin/console.conf <<END_OF_DATA
+@output /dev/null
+messages
+label storage=File1
+TestVolume001
+label storage=File1
+TestVolume002
+update Volume=TestVolume001
+6
+3000000
+10
+@output
+run job=NightlySave storage=File1
+yes
+wait
+messages
+@#
+@# now purge the Volume
+@#
+purge volume=TestVolume001
+purge volume=TestVolume002
+delete volume=TestVolume001
+yes
+delete volume=TestVolume002
+yes
+quit
+END_OF_DATA
+bin/bacula stop
+echo "volume=TestVolume001|TestVolume002" >tmp/bscan.bsr
+bin/bscan -w working -m -s -v -b tmp/bscan.bsr -c bin/bacula-sd.conf ${cwd}/tmp
+bin/bacula start
+bin/console -c bin/console.conf <<END_OF_DATA
+@output /dev/null
+messages
+@#
+@# now do a restore
+@#
+restore where=${cwd}/tmp/bacula-restores
+5
+done
+yes
+wait
+messages
+quit
+END_OF_DATA
+bin/bacula stop
+diff -r build tmp/bacula-restores${cwd}/build
+if [ $? != 0 ] ; then
+ echo " "
+ echo " "
+ echo " ===== bscan-test Bacula source failed!!! ===== "
+ echo " ===== bscan-test failed!!! ===== " >>test.out
+ echo " "
+else
+ echo " ===== bscan-test Bacula source OK ===== "
+ echo " ===== bscan-test OK ===== " >>test.out
+ scripts/cleanup
+fi