--- /dev/null
+#!/bin/sh
+#
+# Cleanup left over files -- both before and after test run
+#
+scripts/cleanup
+
+if ! test x@autochanger@ = x/dev/null; then
+ drive=`bin/mtx-changer @autochanger@ loaded 0 @tape_drive1@ 1`
+ if ! test x$drive = x2; then
+ bin/mtx-changer @autochanger@ unload $drive @tape_drive1@ 1
+ bin/mtx-changer @autochanger@ load 2 @tape_drive1@ 1
+ fi
+ mt -f @tape_drive1@ rewind
+ mt -f @tape_drive1@ weof
+fi
+
+
+#
+# If we have an autochanger always load tape in slot 1
+#
+if ! test x@autochanger@ = x/dev/null; then
+ drive=`bin/mtx-changer @autochanger@ loaded 0 @tape_drive@ 0`
+ if ! test x$drive = x1; then
+ bin/mtx-changer @autochanger@ unload $drive @tape_drive@ 0
+ bin/mtx-changer @autochanger@ load 1 @tape_drive@ 0
+ fi
+fi
+
+mt -f @tape_drive@ rewind
+mt -f @tape_drive@ weof
sed -f ${out} ${cwd}/scripts/bacula-sd-2drive.conf.in >${cwd}/scripts/bacula-sd-2drive.conf
sed -f ${out} ${cwd}/scripts/cleanup-tape.in >${cwd}/scripts/cleanup-tape
sed -f ${out} ${cwd}/scripts/cleanup-2tape.in >${cwd}/scripts/cleanup-2tape
+sed -f ${out} ${cwd}/scripts/cleanup-2drive.in >${cwd}/scripts/cleanup-2drive
sed -f ${out} ${cwd}/scripts/prepare-two-tapes.in >${cwd}/scripts/prepare-two-tapes
cp ${cwd}/bin/bacula-sd.conf /tmp/bac$$
sed s%/tmp%${cwd}/tmp%g /tmp/bac$$ >${cwd}/bin/bacula-sd.conf