]> git.sur5r.net Git - bacula/bacula/blob - regress/scripts/prepare-two-tapes.in
regress: fix regress-win32 prog to handle monitor section in bacula-fd.conf
[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 # with disk-changer, we have to initialize slots
13 init_slot @tape_drive@ $SLOT1
14 init_slot @tape_drive@ $SLOT2
15
16 #
17 # init first of two slots
18 # optimize so we don't unnecessarily unload and load slots
19 #
20 if test x@autochanger@ != x/dev/null; then
21    slot=`$scripts/@changer_script@ @autochanger@ loaded 0 @tape_drive@ $DRIVE1`
22    case $slot in
23    0)
24       $scripts/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1
25       slot=$SLOT1
26       ;;
27    $SLOT1)
28       slot=$SLOT1
29       ;;
30    $SLOT2)
31       slot=$SLOT2
32       ;;
33    *)
34       $scripts/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1
35       $scripts/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1
36       slot=$SLOT1
37       ;;
38   esac
39   init_drive @tape_drive@
40   $scripts/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1
41
42
43 # init the other slot
44   case $slot in
45    $SLOT1)
46       $scripts/@changer_script@ @autochanger@ load $SLOT2 @tape_drive@ $DRIVE1
47       ;;
48    $SLOT2)
49       $scripts/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1
50       ;;
51    *)
52       echo "Something went wrong. Expected $SLOT1 or $SLOT2, got $slot"
53       exit 1
54    esac
55    init_drive @tape_drive@
56 fi