]> git.sur5r.net Git - bacula/bacula/blob - regress/scripts/prepare-two-tapes.in
Optimize prepare-two-tapes + add -j3 to make
[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       slot=$SLOT1
21       ;;
22    $SLOT1)
23       slot=$SLOT1
24       ;;
25    $SLOT2)
26       slot=$SLOT2
27       ;;
28    default)
29       bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1
30       bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1
31       slot=$SLOT1
32       ;;
33   esac
34   init_drive @tape_drive@
35   bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1
36
37
38 # init the other slot
39   case $slot in
40    $SLOT1)
41       bin/@changer_script@ @autochanger@ load $SLOT2 @tape_drive@ $DRIVE1
42       ;;
43    $SLOT2)
44       bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1
45       ;;
46    default)
47       echo "Something went wrong. Expected $SLOT1 or $SLOT2, got $slot"
48       exit 1
49    esac
50    init_drive @tape_drive@
51 fi