From 39e32e890b7bd1b5738ee962d95bebda6211d5d1 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Thu, 8 May 2008 21:01:52 +0000 Subject: [PATCH] ebl tweak base scripts to use faketape Add AUTOCHANGER_SCRIPT variable (default to mtx-changer) git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6921 91ce42f0-d328-0410-95d8-f526ca767f89 --- regress/scripts/bacula-sd-2d.conf.in | 2 +- regress/scripts/bacula-sd-2drive.conf.in | 2 +- regress/scripts/bacula-sd-2tape.conf.in | 2 +- regress/scripts/cleanup-2drive.in | 20 ++++++++++---------- regress/scripts/cleanup-2tape.in | 23 +++++++++-------------- regress/scripts/cleanup-tape.in | 15 ++++++--------- regress/scripts/create_sed | 2 ++ regress/scripts/functions | 10 ++++++++++ regress/scripts/prepare-two-tapes.in | 24 ++++++++++-------------- 9 files changed, 50 insertions(+), 50 deletions(-) diff --git a/regress/scripts/bacula-sd-2d.conf.in b/regress/scripts/bacula-sd-2d.conf.in index 466b68fcc6..bb80a48ebb 100644 --- a/regress/scripts/bacula-sd-2d.conf.in +++ b/regress/scripts/bacula-sd-2d.conf.in @@ -31,7 +31,7 @@ Director { Autochanger { Name = DDS-4 Changer Device = @autochanger@ - Changer Command ="@scriptdir@/mtx-changer %c %o %S %a %d" + Changer Command ="@scriptdir@/@changer_script@ %c %o %S %a %d" Device = Drive-0 } diff --git a/regress/scripts/bacula-sd-2drive.conf.in b/regress/scripts/bacula-sd-2drive.conf.in index 8ee4dbd629..12d2e8d6c7 100644 --- a/regress/scripts/bacula-sd-2drive.conf.in +++ b/regress/scripts/bacula-sd-2drive.conf.in @@ -34,7 +34,7 @@ Director { Autochanger { Name = DDS-4 Changer Device = @autochanger@ - Changer Command ="@scriptdir@/mtx-changer %c %o %S %a %d" + Changer Command ="@scriptdir@/@changer_script@ %c %o %S %a %d" Device = Drive-0, Drive-1 } diff --git a/regress/scripts/bacula-sd-2tape.conf.in b/regress/scripts/bacula-sd-2tape.conf.in index 4abd813945..07a50c4085 100644 --- a/regress/scripts/bacula-sd-2tape.conf.in +++ b/regress/scripts/bacula-sd-2tape.conf.in @@ -34,7 +34,7 @@ Director { Autochanger { Name = DDS-4 Changer Device = @autochanger@ - Changer Command ="@scriptdir@/mtx-changer %c %o %S %a %d" + Changer Command ="@scriptdir@/@changer_script@ %c %o %S %a %d" Device = Drive-0 } diff --git a/regress/scripts/cleanup-2drive.in b/regress/scripts/cleanup-2drive.in index a4ff193dd8..a6c64911fe 100755 --- a/regress/scripts/cleanup-2drive.in +++ b/regress/scripts/cleanup-2drive.in @@ -5,40 +5,40 @@ scripts/cleanup if test x@autochanger@ != x/dev/null; then - slot=`bin/mtx-changer @autochanger@ loaded 0 @tape_drive1@ 1` + slot=`bin/@changer_script@ @autochanger@ loaded 0 @tape_drive1@ 1` echo "Slot $slot in drive 1" if test x$slot != x0 ; then echo "unload slot $slot in drive 1" - bin/mtx-changer @autochanger@ unload $slot @tape_drive1@ 1 + bin/@changer_script@ @autochanger@ unload $slot @tape_drive1@ 1 fi - slot=`bin/mtx-changer @autochanger@ loaded 0 @tape_drive@ 0` + slot=`bin/@changer_script@ @autochanger@ loaded 0 @tape_drive@ 0` echo "Slot $slot in drive 0" if test x$slot != x0 ; then echo "unload slot $slot in drive 0" - bin/mtx-changer @autochanger@ unload $slot @tape_drive@ 0 + bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ 0 fi - slot=`bin/mtx-changer @autochanger@ loaded 0 @tape_drive1@ 1` + slot=`bin/@changer_script@ @autochanger@ loaded 0 @tape_drive1@ 1` if test x$slot != x$SLOT2; then echo "load slot $SLOT2 in drive 1" - bin/mtx-changer @autochanger@ load $SLOT2 @tape_drive1@ 1 + bin/@changer_script@ @autochanger@ load $SLOT2 @tape_drive1@ 1 fi echo "WEOF drive 1" mt -f @tape_drive1@ rewind mt -f @tape_drive1@ weof echo "unload slot $SLOT2 in drive 1" - bin/mtx-changer @autochanger@ unload $SLOT2 @tape_drive1@ 1 + bin/@changer_script@ @autochanger@ unload $SLOT2 @tape_drive1@ 1 - slot=`bin/mtx-changer @autochanger@ loaded 0 @tape_drive@ 0` + slot=`bin/@changer_script@ @autochanger@ loaded 0 @tape_drive@ 0` echo "Slot $slot in drive 0" if test x$slot != x$SLOT1; then echo "load slot $SLOT1 in drive 0" - bin/mtx-changer @autochanger@ load $SLOT1 @tape_drive@ 0 + bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ 0 fi echo "WEOF drive 0" mt -f @tape_drive@ rewind mt -f @tape_drive@ weof echo "unload slot $SLOT1 from drive 0" - bin/mtx-changer @autochanger@ unload $SLOT1 @tape_drive@ 0 + bin/@changer_script@ @autochanger@ unload $SLOT1 @tape_drive@ 0 fi diff --git a/regress/scripts/cleanup-2tape.in b/regress/scripts/cleanup-2tape.in index a4c90ab0b9..b937ea115e 100755 --- a/regress/scripts/cleanup-2tape.in +++ b/regress/scripts/cleanup-2tape.in @@ -8,13 +8,13 @@ scripts/cleanup if test x@autochanger@ != x/dev/null; then - slot=`bin/mtx-changer @autochanger@ loaded 0 dummy $DRIVE1` + slot=`bin/@changer_script@ @autochanger@ loaded 0 @tape_drive@ $DRIVE1` if test "x${slot}" != "x$SLOT2"; then - bin/mtx-changer @autochanger@ unload $slot @tape_drive@ $DRIVE1 - bin/mtx-changer @autochanger@ load $SLOT2 @tape_drive@ $DRIVE1 + bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1 + bin/@changer_script@ @autochanger@ load $SLOT2 @tape_drive@ $DRIVE1 fi - mt -f @tape_drive@ rewind - mt -f @tape_drive@ weof + + init_drive @tape_drive@ fi @@ -22,17 +22,12 @@ fi # If we have an autochanger always load tape in slot 1 # if test x@autochanger@ != x/dev/null; then - slot=`bin/mtx-changer @autochanger@ loaded 0 dummy $DRIVE1` + slot=`bin/@changer_script@ @autochanger@ loaded 0 @tape_drive@ $DRIVE1` if test "x${slot}" != "x$SLOT1"; then - bin/mtx-changer @autochanger@ unload $slot @tape_drive@ $DRIVE1 - bin/mtx-changer @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1 + bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1 + bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1 fi fi -if test a$USE_FAKETAPE = a; then - mt -f @tape_drive@ rewind - mt -f @tape_drive@ weof -else - cp /dev/null @tape_drive@ -fi +init_drive @tape_drive@ diff --git a/regress/scripts/cleanup-tape.in b/regress/scripts/cleanup-tape.in index 56724a43ea..ce996089c3 100755 --- a/regress/scripts/cleanup-tape.in +++ b/regress/scripts/cleanup-tape.in @@ -2,21 +2,18 @@ # # Cleanup left over files -- both before and after test run # -. ./config + +. scripts/functions scripts/cleanup if test "x@autochanger@" != "x/dev/null" ; then - a=`bin/mtx-changer @autochanger@ loaded $SLOT1 @tape_drive@ 0` + a=`bin/@changer_script@ @autochanger@ loaded $SLOT1 @tape_drive@ 0` if test $a = 0 ; then - bin/mtx-changer @autochanger@ load $SLOT1 @tape_drive@ 0 + bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ 0 fi fi -if test a$USE_FAKETAPE = a; then - mt -f @tape_drive@ rewind - mt -f @tape_drive@ weof -else - cp /dev/null @tape_drive@ -fi +init_drive @tape_drive@ + diff --git a/regress/scripts/create_sed b/regress/scripts/create_sed index 11ba5ff81e..665913c518 100755 --- a/regress/scripts/create_sed +++ b/regress/scripts/create_sed @@ -10,6 +10,7 @@ out="${cwd}/tmp/sed_tmp" # set the ports used by these tests BASEPORT=${BASEPORT:-8101} +AUTOCHANGER_SCRIPT=${AUTOCHANGER_SCRIPT:-mtx-changer} LIBDBI=${LIBDBI:- } libdbi=${LIBDBI} srcdir=${BACULA_SOURCE} @@ -30,6 +31,7 @@ echo "s%@subsysdir@%${cwd}/working%g" >>${out} echo "s%@job_email@%${EMAIL}%g" >>${out} echo "s%@tape_drive@%${TAPE_DRIVE}%g" >>${out} echo "s%@autochanger@%${AUTOCHANGER}%g" >>${out} +echo "s%@changer_script@%${AUTOCHANGER_SCRIPT}%g" >>${out} echo "s%@tmpdir@%${cwd}/tmp%g" >>${out} echo "s%@hostname@%${HOST}%g" >>${out} echo "s%@changer_path@%${AUTOCHANGER_PATH}%g" >>${out} diff --git a/regress/scripts/functions b/regress/scripts/functions index 7a29bc48a1..a6ab409bae 100644 --- a/regress/scripts/functions +++ b/regress/scripts/functions @@ -252,6 +252,16 @@ debug_wait() fi } +init_drive() +{ + if test a$USE_FAKETAPE = a; then + mt -f $1 rewind + mt -f $1 weof + else + cp /dev/null $1 + fi +} + # Save current directory cwd=`pwd` if test "x${REGRESS_DEBUG}" = "x1"; then diff --git a/regress/scripts/prepare-two-tapes.in b/regress/scripts/prepare-two-tapes.in index 1da1846509..b937ea115e 100755 --- a/regress/scripts/prepare-two-tapes.in +++ b/regress/scripts/prepare-two-tapes.in @@ -8,13 +8,13 @@ scripts/cleanup if test x@autochanger@ != x/dev/null; then - slot=`bin/mtx-changer @autochanger@ loaded 0 dummy $DRIVE1` + slot=`bin/@changer_script@ @autochanger@ loaded 0 @tape_drive@ $DRIVE1` if test "x${slot}" != "x$SLOT2"; then - bin/mtx-changer @autochanger@ unload $slot @tape_drive@ $DRIVE1 - bin/mtx-changer @autochanger@ load $SLOT2 @tape_drive@ $DRIVE1 + bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1 + bin/@changer_script@ @autochanger@ load $SLOT2 @tape_drive@ $DRIVE1 fi - mt -f @tape_drive@ rewind - mt -f @tape_drive@ weof + + init_drive @tape_drive@ fi @@ -22,16 +22,12 @@ fi # If we have an autochanger always load tape in slot 1 # if test x@autochanger@ != x/dev/null; then - slot=`bin/mtx-changer @autochanger@ loaded 0 dummy $DRIVE1` + slot=`bin/@changer_script@ @autochanger@ loaded 0 @tape_drive@ $DRIVE1` if test "x${slot}" != "x$SLOT1"; then - bin/mtx-changer @autochanger@ unload $slot @tape_drive@ $DRIVE1 - bin/mtx-changer @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1 + bin/@changer_script@ @autochanger@ unload $slot @tape_drive@ $DRIVE1 + bin/@changer_script@ @autochanger@ load $SLOT1 @tape_drive@ $DRIVE1 fi fi -if test a$USE_FAKETAPE = a; then - mt -f @tape_drive@ rewind - mt -f @tape_drive@ weof -else - cp /dev/null @tape_drive@ -fi +init_drive @tape_drive@ + -- 2.39.5