]> git.sur5r.net Git - bacula/bacula/blob - regress/scripts/prepare-two-tapes.in
Port missing RestoreObject Plugin Config code from BEE.
[bacula/bacula] / regress / scripts / prepare-two-tapes.in
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6
7 #
8 # Cleanup left over files -- both before and after test run
9 #
10 # Write an EOF on tape in slot $SLOT1  and  on tape in $SLOT2
11
12 . scripts/functions
13
14 scripts/cleanup
15
16
17 # with disk-changer, we have to initialize slots
18 init_slot @tape_drive@ $SLOT1
19 init_slot @tape_drive@ $SLOT2
20
21 #
22 # init first of two slots
23 # optimize so we don't unnecessarily unload and load slots
24 #
25 if test x@autochanger@ != x/dev/null; then
26    slot=`$scripts/@changer_script@ @autochanger@ loaded 0 @tape_drive@ $DRIVE1`
27    case $slot in
28    0)
29       $scripts/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1
30       slot=$SLOT1
31       ;;
32    $SLOT1)
33       slot=$SLOT1
34       ;;
35    $SLOT2)
36       slot=$SLOT2
37       ;;
38    *)
39       $scripts/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1
40       $scripts/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1
41       slot=$SLOT1
42       ;;
43   esac
44   init_drive @tape_drive@
45   $scripts/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1
46
47
48 # init the other slot
49   case $slot in
50    $SLOT1)
51       $scripts/@changer_script@ @autochanger@ load $SLOT2 @tape_drive@ $DRIVE1
52       ;;
53    $SLOT2)
54       $scripts/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1
55       ;;
56    *)
57       echo "Something went wrong. Expected $SLOT1 or $SLOT2, got $slot"
58       exit 1
59    esac
60    init_drive @tape_drive@
61 fi