]> git.sur5r.net Git - bacula/bacula/blob - regress/scripts/prepare-fake-autochanger.in
9bf81443baf56516991765d4728b2db57f497124
[bacula/bacula] / regress / scripts / prepare-fake-autochanger.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 # This script will prepare a big dummy autochanger 
9 #
10
11 . scripts/functions
12
13 adir=@working_dir@/ach
14 rm -rf $adir
15
16 mkdir $adir 2> /dev/null
17
18 # work with $1 slots by default
19 nb_slot=${1:-80}
20
21 # create the autochanger configuration file
22 cat > $adir/conf <<EOF
23 maxdrive=8
24 maxslot=$nb_slot
25 dbgfile=$adir/log
26
27 #case $2 in
28 #list|slots)
29 #   sleep 2
30 #   ;;
31 #*)
32 #   sleep 5
33 #   ;;
34 #esac
35 EOF
36
37 # turn on ach debug
38 touch $adir/log
39
40 nb_vol=`expr $nb_slot - 5`
41 # create $nb_vol volumes
42 for i in `seq 1 $nb_vol`; do
43    echo $i:vol$i >> $adir/barcodes
44    cp /dev/null $adir/slot$i
45 done
46
47 # make a cleaning tape
48 cln_slot=`expr $nb_vol + 1`
49 echo $cln_slot:CLN01 >> $adir/barcodes
50 cp /dev/null $adir/slot$cnl_slot
51
52 # keep other empty
53 next_empty=`expr $cnl_slot + 1`
54 for i in `seq $next_empty $nb_slot`; do
55    echo $i:  >> $adir/barcodes
56 done