X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=changer-src%2Fchg-multi.sh.in;h=af324327a1e79a6a11d54fc89e41c5be45e68138;hb=8648195fe8571a079cef7a8aea39d1c469218767;hp=a5d3fdbbe14a068a74ebc4b5da1c25a163c33e83;hpb=b49b70c6dbcd41a2b25684de06e5116c7ef3a7b3;p=debian%2Famanda diff --git a/changer-src/chg-multi.sh.in b/changer-src/chg-multi.sh.in index a5d3fdb..af32432 100644 --- a/changer-src/chg-multi.sh.in +++ b/changer-src/chg-multi.sh.in @@ -30,27 +30,53 @@ # chg-multi.sh - generic tape changer script # -# source utility functions and values from configure +prefix=@prefix@ exec_prefix=@exec_prefix@ +sbindir=@sbindir@ libexecdir=@libexecdir@ -. ${libexecdir}/chg-lib.sh pname="chg-multi" +PATH=$sbindir:$libexecdir:/usr/bin:/bin:/usr/sbin:/sbin:/usr/ucb +export PATH + if [ -d "@AMANDA_DBGDIR@" ]; then logfile=@AMANDA_DBGDIR@/changer.debug else logfile=/dev/null fi +# support simultaneous development with and without gettext +_() { + fmt="$1" + shift + printf "$fmt" $* +} + echo `_ "arguments ->"` "$@" >> $logfile -ourconf=`amgetconf changerfile` +USE_VERSION_SUFFIXES="@USE_VERSION_SUFFIXES@" +if test "$USE_VERSION_SUFFIXES" = "yes"; then + SUF="-@VERSION@" +else + SUF= +fi + +ourconf=`amgetconf$SUF changerfile` -if ! error=try_find_mt; then - echo $error - exit 2 +if [ -x $sbindir/ammt$SUF ]; then + MT=$sbindir/ammt$SUF + MTF=-f +elif [ -x "@MT@" ]; then + MT=@MT@ + MTF=@MT_FILE_FLAG@ +else + answer=`_ ' %s: mt program not found' "$myname"` + echo `_ 'Exit ->'` $answer >> $logfile + echo $answer + exit 1 fi +echo "MT ->" $MT $MTF >> $logfile EXPR=expr # EXPR=/usr/local/bin/expr # in case you need a more powerful expr... @@ -300,7 +326,8 @@ then exit 2 fi echo `_ ' -> offline'` "$device" >> $logfile - if ! try_eject_device $device; then + $MT $MTF $device offline >> $logfile 2>&1 + if [ $? -ne 0 ]; then answer=`_ '%s %s: %s: unable to change to slot %s' "$newslot" "$pname" "$device" "$curslot"` echo `_ 'Exit ->'` $answer >> $logfile echo $answer @@ -343,7 +370,7 @@ then exit 2 fi echo `_ ' -> offline'` $device >> $logfile - try_eject_device $device + $MT $MTF $device offline >> $logfile 2>&1 if [ $? -ne 0 ]; then # # XXX if the changer-specific eject command can distinguish @@ -382,7 +409,8 @@ if [ $loadslot -eq 1 ]; then # load the tape from the slot echo $answer exit 2 fi - amdevcheck_status $device + echo `_ ' -> rewind'` $device >> $logfile + $MT $MTF $device rewind >> $logfile 2>&1 if [ $? -ne 0 ]; then # # XXX if the changer-specific load command can distinguish