1#!/bin/sh
2#
3# Run a simple backup but
4#   split the archive into two volumes, then build a BSR with
5#   the restore command and use bextract to restore the files.
6#
7TestName="bextract-test"
8JobName="bextract"
9. scripts/functions
10
11scripts/cleanup
12scripts/copy-test-confs
13change_jobname NightlySave $JobName
14
15# Directory to backup.
16# This directory will be created by setup_data().
17BackupDirectory="${tmp}/data"
18
19# Use a tgz to setup data to be backuped.
20# Data will be placed at "${tmp}/data/".
21setup_data data/small.tgz
22
23
24start_test
25
26cat <<END_OF_DATA >${cwd}/tmp/bconcmds
27@$out /dev/null
28messages
29@$out ${cwd}/tmp/log1.out
30label storage=File1 volume=TestVolume001 pool=Default
31label storage=File1 volume=TestVolume002 pool=Default
32update Volume=TestVolume001 MaxVolBytes=10000
33@#setdebug level=400 dir
34setdebug level=400 storage=File1
35run job=$JobName storage=File1 yes
36wait
37messages
38@#
39@# now build the bsr file but do not restore
40@#
41@$out ${tmp}/log2.out
42restore bootstrap=${working}/restore.bsr where=${tmp}/bareos-restores select all storage=File1 done
43no
44wait
45messages
46quit
47END_OF_DATA
48
49run_bareos
50check_for_zombie_jobs storage=File1
51stop_bareos
52
53mkdir -p ${cwd}/tmp/bareos-restores
54if test "$debug" -eq 1 ; then
55  $bin/bextract -v -c ${conf} -b ${working}/restore.bsr ${tmp} ${tmp}/bareos-restores
56else
57  $bin/bextract -c ${conf} -b ${working}/restore.bsr ${tmp} ${tmp}/bareos-restores 2>&1 >/dev/null
58fi
59rstat=$?
60grep "^  Termination: *Backup OK" ${tmp}/log1.out 2>&1 >/dev/null
61bstat=$?
62check_restore_diff
63end_test
64