1#!/bin/sh
2#
3# Run a simple backup  using the Sparse option
4#   then restore it.
5#
6TestName="sparse-autoxflate-test"
7JobName=SparseTest
8. scripts/functions
9
10scripts/cleanup
11scripts/copy-test-confs
12
13# Directory to backup.
14# This directory will be created by setup_data().
15BackupDirectory="${tmp}/data"
16
17# Use a tgz to setup data to be backuped.
18# Data will be placed at "${tmp}/data/".
19setup_data data/small.tgz
20
21# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list".
22echo "${BackupDirectory}" >${tmp}/file-list
23
24
25
26
27
28mv ${cwd}/bin/bareos-sd.conf ${cwd}/bin/bareos-sd.conf.sed
29
30# enable autoxflate plugin
31sed 's@# Maximum File Size = 10KB@# autoxflate plugin settings\
32  autodeflate = both  # in/out/both\
33  autodeflatealgorithm = gzip # gzip / lzo / lzfast / lz4 / lz4hc\
34  # autodeflatelevel = 6 # compression level for gzip\
35  autoinflate = both  # in/out/both\
36@g' < ${cwd}/bin/bareos-sd.conf.sed > ${cwd}/bin/bareos-sd.conf
37
38
39# enable plugin directory
40mv ${cwd}/bin/bareos-sd.conf ${cwd}/bin/bareos-sd.conf.sed
41# enable autoxflate plugin
42sed 's@Pid Directory.*@\
43Plugin Directory =\"'"${plugindir}"'\"\
44@g' < ${cwd}/bin/bareos-sd.conf.sed > ${cwd}/bin/bareos-sd.conf
45
46start_test
47
48cat >${cwd}/tmp/bconcmds <<END_OF_DATA
49@$out /dev/null
50messages
51@$out ${cwd}/tmp/log1.out
52label storage=File volume=TestVolume001
53run job=$JobName yes
54wait
55messages
56@#
57@# now do a restore
58@#
59@$out ${cwd}/tmp/log2.out
60restore where=${cwd}/tmp/bareos-restores select storage=File
61unmark *
62mark *
63done
64yes
65wait
66messages
67quit
68END_OF_DATA
69
70run_bareos
71check_for_zombie_jobs storage=File
72stop_bareos
73
74check_two_logs
75check_restore_diff
76end_test
77