#
 
 Director {                            # define myself
-  Name = rufus-dir
+  Name = roxie-dir
   DIRport = 8101                # where we listen for UA connections
   QueryFile = "/home/kern/bacula/regress/bin/query.sql"
   WorkingDirectory = "/home/kern/bacula/regress/working"
 
    fi
    mt -f @tape_drive1@ rewind
    mt -f @tape_drive1@ weof
+   bin/mtx-changer @autochanger@ unload 2 @tape_drive1@ 1
 fi
 
 
 
 mt -f @tape_drive@ rewind
 mt -f @tape_drive@ weof
+bin/mtx-changer @autochanger@ unload 1 @tape_drive@ 0
 
 /bin/cp -f scripts/bacula-sd-2drive.conf bin/bacula-sd.conf
 /bin/cp -f scripts/test-bacula-fd.conf bin/bacula-fd.conf
 /bin/cp -f scripts/test-console.conf bin/bconsole.conf
+outf="tmp/sed_tmp"
+echo "s%# Autochanger = yes%  Autochanger = yes%g" >${outf}
+cp bin/bacula-dir.conf tmp/1
+sed -f ${outf} tmp/1 >bin/bacula-dir.conf
 touch bin/tape_options
 
 @$out /dev/null
 messages
 @$out tmp/log1.out
-label storage=DDS-4 volume=TestVolume001 slot=1 Pool=Default
-label storage=DDS-4 volume=TestVolume002 slot=2 Pool=Default
+label storage=DDS-4 volume=TestVolume001 slot=1 Pool=Default drive=0
+label storage=DDS-4 volume=TestVolume002 slot=2 Pool=Default drive=1
 run job=NightlySave yes
 wait
+status storage=DDS-4
 messages
 quit
 END_OF_DATA
 fi
 echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt
 echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
+
+cat <<END_OF_DATA >tmp/bconcmds
 @$out /dev/null
 messages
 @$out tmp/log1.out
 @# Force Incremental on the second Volume
 update volume=TestVolume001 VolStatus=Used
+status storage=DDS-4
 run level=Incremental job=NightlySave yes
 wait
+status storage=DDS-4
 messages
 @# 
 @# now do a restore
 @$out
 quit
 END_OF_DATA
+if test "$debug" -eq 1 ; then
+  bin/bacula start
+  cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
+else
+  bin/bacula start 2>&1 >/dev/null
+  cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf  2>&1 >/dev/null
+fi
+
 bin/bacula stop 2>&1 >/dev/null
 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
 bstat=$?