]> git.sur5r.net Git - bacula/bacula/blob - regress/scripts/prepare-two-tapes.in
Optimize writing EOF on two tapes
[bacula/bacula] / regress / scripts / prepare-two-tapes.in
1 #!/bin/sh
2 #
3 # Cleanup left over files -- both before and after test run
4 #
5 # Write an EOF on tape in slot $SLOT1  and  on tape in $SLOT2
6
7 . scripts/functions
8
9 scripts/cleanup
10
11 #
12 # init first of two slots
13 # optimize so we don't unnecessarily unload and load slots
14 #
15 if test x@autochanger@ != x/dev/null; then
16    slot=`bin/@changer_script@ @autochanger@ loaded 0 @tape_drive@ $DRIVE1`
17    case $slot in
18    0)
19       bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1
20       init_drive @tape_drive@
21       slot=$SLOT1
22       ;;
23    $SLOT1)
24       init_drive @tape_drive@
25       slot=$SLOT1
26       ;;
27    $SLOT2)
28       init_drive @tape_drive@
29       slot=$SLOT2
30       ;;
31   esac
32
33 # init the other slot
34   case $slot in
35    $SLOT1)
36       bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1
37       bin/@changer_script@ @autochanger@ load $SLOT2 @tape_drive@ $DRIVE1
38       init_drive @tape_drive@
39       ;;
40    $SLOT2)
41       bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1
42       bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1
43       init_drive @tape_drive@
44       ;;
45    esac
46 fi