]> git.sur5r.net Git - bacula/bacula/blobdiff - regress/scripts/cleanup-tape.in
ebl Add sleep in vtape changer to simulate real hardware
[bacula/bacula] / regress / scripts / cleanup-tape.in
index 56724a43eaad60b4732f1d990458e020f0a9359b..e08b12a854b3be6a53d31ccf41c9c835a45f16b1 100755 (executable)
@@ -1,22 +1,29 @@
 #!/bin/sh
 #
-# Cleanup left over files -- both before and after test run
+# Cleanup left over files, then load $SLOT1 into drive and    
+#   write an EOF on it.
 #
-. ./config
+
+. scripts/functions
 
 scripts/cleanup
 
-if test "x@autochanger@" != "x/dev/null" ; then
-   a=`bin/mtx-changer @autochanger@ loaded $SLOT1 @tape_drive@ 0`
-   if test $a = 0 ; then
-     bin/mtx-changer @autochanger@ load $SLOT1 @tape_drive@ 0
-   fi
-fi
+# init slot for vtape driver
+init_slot @tape_drive@ $SLOT1
 
-if test a$USE_FAKETAPE = a; then
-   mt -f @tape_drive@ rewind
-   mt -f @tape_drive@ weof
-else
-   cp /dev/null @tape_drive@
+if test x@autochanger@ != x/dev/null; then
+   slot=`$scripts/@changer_script@ @autochanger@ loaded 0 @tape_drive@ $DRIVE1`
+   case $slot in
+   0)
+      $scripts/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1
+      ;;
+   $SLOT1)
+      ;;
+   *)
+      $scripts/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1
+      $scripts/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1
+      ;;
+  esac
 fi
 
+init_drive @tape_drive@