]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
regress: tweak incremental-2media-tape to load the first tape
authorKern Sibbald <kern@sibbald.com>
Wed, 18 Jan 2017 13:05:54 +0000 (14:05 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:57:02 +0000 (13:57 +0200)
regress/tests/incremental-2media-tape

index 16435205f16d16a8fbf7b88990dd795a54dd3621..8de69a3813a3b1cc97358fcdbd70d8f65212eaaf 100755 (executable)
@@ -1,9 +1,7 @@
 #!/bin/sh
 #
-# Copyright (C) 2000-2022 Kern Sibbald
+# Copyright (C) 2000-2020 Kern Sibbald
 # License: BSD 2-Clause; see file LICENSE-FOSS
-#
-
 #
 # Run a simple backup of the Bacula build directory then create some           
 #   new files, do an Incremental onto a different medium 
@@ -31,10 +29,23 @@ if test x`uname` = xFreeBSD ; then
    cp -f scripts/freebsd_tape_options bin/tape_options
 fi
 
-mt -f /dev/nst0 rewind
-mt -f /dev/nst0 weof
-mt -f /dev/nst1 rewind
-mt -f /dev/nst1 weof
+mt -f /dev/nst0 status | grep ONLINE >/dev/null
+stat=$?
+if [ $stat -eq 0 ] ; then
+  mt -f /dev/nst0 rewind
+  mt -f /dev/nst0 weof
+else
+  mtx -f $AUTOCHANGER load 1 0
+fi
+mt -f /dev/nst1 status | grep ONLINE >/dev/null
+stat=$?
+if [ $stat -eq 0 ] ; then
+  mt -f /dev/nst1 rewind
+  mt -f /dev/nst1 weof
+else
+  mtx -f $AUTOCHANGER load 2 1
+  mtx -f $AUTOCHANGER status
+fi
 
 echo "${cwd}/build" >${cwd}/tmp/file-list