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