1#!/bin/sh 2# 3# Attempt to backup and restore a file with the delta plugin 4# 5 6TestName="delta-test" 7JobName=pluginTest 8. scripts/functions 9 10scripts/cleanup 11scripts/copy-plugin-confs 12 13cat << EOF >> $conf/bareos-dir.conf 14FileSet { 15 Name = "FS_DELTA" 16 Include { 17 Options { 18 signature=MD5 19 } 20 Plugin = "delta-test" 21 } 22} 23EOF 24 25$bperl -e 'add_attribute("$conf/bareos-dir.conf", "FileSet", "FS_DELTA", "Job", "pluginTest")' 26$bperl -e 'add_attribute("$conf/bareos-dir.conf", "Accurate", "yes", "Job", "pluginTest")' 27 28# install the delta plugin 29make -C build/src/plugins/fd install-test-plugin >/dev/null 30 31start_test 32 33cat <<END_OF_DATA >${cwd}/tmp/bconcmds 34@$out /dev/null 35messages 36@$out ${cwd}/tmp/log1.out 37label storage=File volume=TestVolume001 38setdebug level=150 client=$CLIENT 39estimate job=$JobName level=Full 40setdebug level=50 client=$CLIENT 41run job=$JobName comment="read 400 bytes of passwd" yes 42wait 43status client=$CLIENT 44messages 45run job=$JobName comment="read 100 bytes of group" level=Incremental yes 46wait 47messages 48run job=$JobName comment="read 100 bytes of hosts" level=Incremental yes 49wait 50messages 51run job=$JobName comment="read 100 bytes of services" level=Incremental yes 52wait 53messages 54status client=$CLIENT 55quit 56END_OF_DATA 57 58run_bareos 59 60cat <<END_OF_DATA >${cwd}/tmp/bconcmds 61messages 62@# 63@# now do a restore 64@# 65@$out ${cwd}/tmp/log2.out 66setdebug level=50 client=$CLIENT 67restore where=$tmp select all done 68yes 69wait 70messages 71@exec "mv $tmp/delta.txt $tmp/delta.OK.txt" 72restore where=$tmp jobid=1 73m * 74done 75yes 76wait 77messages 78@$out ${cwd}/tmp/log3.out 79status client 80setdebug level=0 client=$CLIENT 81quit 82END_OF_DATA 83 84run_bconsole 85 86check_two_logs 87 88stop_bareos 89 90head -c 50 /etc/passwd > $tmp/source 91head -c 50 /etc/group >> $tmp/source 92head -c 50 /etc/hosts >> $tmp/source 93head -c 100 /etc/services >> $tmp/source 94head -c 400 /etc/passwd | tail -c 150 >> $tmp/source 95 96diff -u $tmp/source $tmp/delta.OK.txt > $tmp/d 97if [ $? -ne 0 ]; then 98 print_debug "ERROR: delta.OK.txt and source are different, restore failed" 99 dstat=1 100fi 101 102head -c 400 /etc/passwd > $tmp/source2 103diff -u $tmp/source2 $tmp/delta.txt > $tmp/d 104if [ $? -ne 0 ]; then 105 print_debug "ERROR: delta.txt and source2 are different, restore failed" 106 dstat=1 107fi 108 109 110 111end_test 112