X-Git-Url: https://git.gag.com/?p=debian%2Famanda;a=blobdiff_plain;f=changer-src%2Fchg-disk.sh.in;h=c4f59f700ddf86df8b17f3bdb21c956f203aac42;hp=543d96d0a1a9a94f248e8b80d1ea5d5635f1ed9c;hb=34197d9f46a5f4e944378cbb65fca32ee0eec7b9;hpb=71325c297e0436e9930a3e129a26696e78c27f62 diff --git a/changer-src/chg-disk.sh.in b/changer-src/chg-disk.sh.in index 543d96d..c4f59f7 100644 --- a/changer-src/chg-disk.sh.in +++ b/changer-src/chg-disk.sh.in @@ -34,16 +34,18 @@ # |- ... # |- slotn # where 'slot_root_dir' is the tapedev 'file:xxx' parameter and 'n' -# is the tapecycle parameter. -# +# is the LASTSLOT value of your changerfile config file. If LASTSLOT is +# not defined, the value of the tapecycle parameter is used. +# # To use this driver, just put the line 'tpchanger "chg-disk"' in your # amanda.conf. # -# Example of use: +# Example of use (amanda.conf): # --- cut here --- # tapedev "file:/BACKUP2/slots/" # rawtapedev "file:/BACKUP2/slots/" # changerdev "/dev/null" +# changerfile "chg-disk" # tpchanger "chg-disk" # changerfile "/usr/local/amanda/etc/changer" # tapetype HARD-DISK @@ -52,7 +54,12 @@ # } # --- cut here --- # -# The number of slot is equal to your tapecyle. +# Example changerfile (chg-disk.conf): +# --- cut here --- +# LASTSLOT=12 +# --- cut here --- +# +# The number of slot is equal to your LASTSLOT or tapecycle. # You must create the slots and data directory. # @@ -75,6 +82,10 @@ fi MYNAME=$0 TAPE=`amgetconf$SUF tapedev` +if test X"$TAPE" == X""; then + echo " tapedev not specified in amanda.conf." 1>&2 + exit 2 +fi SLOTDIR=`echo $TAPE | sed 's/^file://'` isinteger() { @@ -99,6 +110,14 @@ fi # need rwx access to directory of changer file CHANGERFILE=`amgetconf$SUF changerfile` +conf_match=`expr "$CHANGERFILE" : .\*\.conf\$` +if [ $conf_match -ge 6 ]; then + CONFIGFILE=$CHANGERFILE + CHANGERFILE=`echo $CHANGERFILE | sed 's/.conf$//g'` +else + CONFIGFILE=$CHANGERFILE.conf +fi + CFDir=`dirname ${CHANGERFILE}` [ -d ${CFDir} -a -r ${CFDir} -a -w ${CFDir} -a -x ${CFDir} ] || { echo "$MYNAME: need 'rwx' access to '$CFDir'" 1>&2 ; exit 2 ; } @@ -125,6 +144,9 @@ isinteger $CLEANCOUNT || { CLEANCOUNT=0 ; echo 0 > $CLEANFILE ; } FIRSTSLOT=1 LASTSLOT=`amgetconf$SUF tapecycle` +if test -r $CONFIGFILE; then + . $CONFIGFILE +fi CURSLOT=0 CLEANSLOT=$LASTSLOT NSLOT=`expr $LASTSLOT - $FIRSTSLOT + 1`