1#!/bin/sh 2# 3# Label two tapes, write to the first, then recycle it and destroy 4# the header. Bareos should discover that, mark the tape in 5# error and continue onto the second tape. 6# 7TestName="bad-label-changer" 8JobName=badlabelchanger 9. scripts/functions 10 11require_tape_drive 12require_autochanger 13 14scripts/cleanup 15scripts/copy-2tape-confs 16scripts/prepare-two-tapes 17 18#outf="tmp/sed_tmp" 19#echo "s%# Maximum File Size% Maximum File Size%g" >${outf} 20#cp ${cwd}/bin/bareos-sd.conf ${cwd}/tmp/1 21#sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bareos-sd.conf 22 23change_jobname $JobName 24 25 26# Directory to backup. 27# This directory will be created by setup_data(). 28BackupDirectory="${tmp}/data" 29 30# Use a tgz to setup data to be backuped. 31# Data will be placed at "${tmp}/data/". 32setup_data data/small.tgz 33 34start_test 35 36# Write out bconsole commands 37cat <<END_OF_DATA >tmp/bconcmds 38@$out /dev/null 39messages 40@$out tmp/log1.out 41label storage=tape volume=TestVolume002 slot=$SLOT2 pool=Default drive=$DRIVE1 42label storage=tape volume=TestVolume001 slot=$SLOT1 pool=Default drive=$DRIVE1 43list volumes 44@#setdebug level=10 client=$CLIENT 45setdebug level=150 storage=tape 46run job=$JobName yes 47wait 48purge volume=TestVolume001 49messages 50quit 51END_OF_DATA 52 53run_bareos 54check_for_zombie_jobs storage=tape 55stop_bareos 56 57# Overwrite TestVolume001 label 58init_drive ${TAPE_DRIVE} 59 60cat <<END_OF_DATA >tmp/bconcmds 61@$out /dev/null 62messages 63list volumes 64run job=$JobName level=Full storage=tape yes 65wait 66messages 67@# 68@# now do a restore 69@# 70@$out tmp/log2.out 71restore where=${cwd}/tmp/bareos-restores select all storage=tape done 72yes 73wait 74messages 75quit 76END_OF_DATA 77 78run_bareos 79check_for_zombie_jobs storage=tape 80stop_bareos 81 82check_two_logs 83check_restore_diff 84end_test 85 86