1#!/bin/sh
2#
3# Run a simple backup. Then create some
4#   new files, do an Incremental and restore those two files.
5#
6TestName="incremental-tape"
7JobName=IncTape
8. scripts/functions
9
10require_tape_drive
11
12scripts/cleanup-tape
13scripts/copy-tape-confs
14change_jobname NightlySave $JobName
15
16# Directory to backup.
17# This directory will be created by setup_data().
18BackupDirectory="${tmp}/data"
19
20# Use a tgz to setup data to be backuped.
21# Data will be placed at "${tmp}/data/".
22setup_data data/flat-c.tgz
23echo "${BackupDirectory}/ficheriro1.txt" >${tmp}/restore-list
24echo "${BackupDirectory}/ficheriro2.txt" >>${tmp}/restore-list
25
26# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list".
27echo "${BackupDirectory}" >${tmp}/file-list
28
29
30start_test
31
32cat <<END_OF_DATA >${cwd}/tmp/bconcmds
33@$out /dev/null
34messages
35@$out ${cwd}/tmp/log1.out
36label storage=tape volume=TestVolume001 slot=0 pool=Default
37run job=$JobName yes
38wait
39messages
40quit
41END_OF_DATA
42
43run_bareos
44check_for_zombie_jobs storage=tape
45
46echo "ficheriro1.txt" >${BackupDirectory}/ficheriro1.txt
47echo "ficheriro2.txt" >${BackupDirectory}/ficheriro2.txt
48
49
50cat <<END_OF_DATA >${cwd}/tmp/bconcmds
51@$out /dev/null
52messages
53@$out ${cwd}/tmp/log1.out
54run level=Incremental job=$JobName yes
55wait
56messages
57@#
58@# now do a restore
59@#
60@$out ${cwd}/tmp/log2.out
61restore where=${cwd}/tmp/bareos-restores storage=tape
627
63<${cwd}/tmp/restore-list
64
65yes
66wait
67messages
68quit
69END_OF_DATA
70
71run_bconsole
72check_for_zombie_jobs storage=tape
73stop_bareos
74check_two_logs
75
76check_restore_files_diff `cat ${tmp}/restore-list`
77
78end_test
79