9 # try to hit all the possibilities here
11 exec_prefix="@exec_prefix@"
13 amlibexecdir="@amlibexecdir@"
14 . "${amlibexecdir}/amanda-sh-lib.sh"
16 debugdir=@AMANDA_DBGDIR@
18 # add sbin and ucb dirs
19 PATH="$PATH:/usr/sbin:/sbin:/usr/ucb"
24 logfile=$debugdir/changer.debug
31 USE_VERSION_SUFFIXES="@USE_VERSION_SUFFIXES@"
32 if test "$USE_VERSION_SUFFIXES" = "yes"; then
45 changerfile=`amgetconf$SUF changerfile`
47 tapedev="null:/dev/xxx$$"
49 cleanfile=$changerfile-clean
50 accessfile=$changerfile-access
51 slotfile=$changerfile-slot
52 [ ! -f $cleanfile ] && echo 0 > $cleanfile
53 [ ! -f $accessfile ] && echo 0 > $accessfile
54 [ ! -f $slotfile ] && echo $firstslot > $slotfile
55 cleancount=`cat $cleanfile`
56 accesscount=`cat $accessfile`
66 # handle special slots...
69 current) newslot=$slot ; load=true;;
70 next) newslot=`expr $slot + 1`; load=true;;
71 advance) newslot=`expr $slot + 1`; load=false;;
72 prev) newslot=`expr $slot - 1`; load=true;;
73 first) newslot=0 ; load=true;;
74 last) newslot=-1 ; load=true;;
75 *) newslot=$2 ; load=true;;
80 newslot=`expr $totalslots - 1`
83 if [ $totalslots -le $newslot ]
87 echo $newslot > $changerfile-slot
93 echo $slot $totalslots 1