3 # Run a simple backup of the Bacula build directory
4 # to a tape where the maximum tape file size is set to 1M
5 # then restore a few files from it. Note, by setting the maximum
6 # file size to 1M, it runs very slow. This tests the
9 TestName="restore-seek-tape"
10 JobName=restore-tape-seek
15 scripts/copy-tape-confs
18 echo "${cwd}/tmp/build" >${cwd}/tmp/file-list
19 rm -rf ${cwd}/tmp/build
20 mkdir ${cwd}/tmp/build
21 # Copy only the .c files (to be restored)
22 # set files to "*.c" for all c files
23 files="ua_tree.c ua_update.c"
26 cp -p ${cwd}/build/src/dird/${i} ${cwd}/tmp/build
31 sed s%\^%${cwd}/tmp/build/% 1 | sort | uniq >restore-list
33 # At this point restore-list contains the list
34 # of files we will restore
39 # Now arrange to backup *everything*
41 rm -rf ${cwd}/tmp/build
42 mkdir ${cwd}/tmp/build
43 cp -fp ${cwd}/build/src/dird/* ${cwd}/tmp/build
45 # Enable MaximumFileSize to ensure lots of JobMedia records and thus
48 cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
49 sed "s%# Maximum File Size = 1000000% Maximum File Size = 10KB%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
51 change_jobname NightlySave $JobName
54 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
57 @$out ${cwd}/tmp/log1.out
58 label storage=tape volume=TestVolume001 pool=Default
65 @$out ${cwd}/tmp/log2.out
67 setdebug level=10 storage=tape
69 @# print the JobMedia records
70 select * from JobMedia;
72 restore bootstrap=${cwd}/tmp/kern.bsr where=${cwd}/tmp/bacula-restores storage=tape
74 <${cwd}/tmp/restore-list
83 check_for_zombie_jobs storage=tape
86 # Now setup a control directory of only what we *should* restore
87 rm -rf ${cwd}/tmp/build
88 mkdir ${cwd}/tmp/build
90 cp -p ${cwd}/build/src/dird/${i} ${cwd}/tmp/build
94 check_restore_tmp_build_diff