1#!/bin/sh 2 3. scripts/functions 4 5# 6# Run a simple backup using the compressed option 7# then backup a second time and finally restore it 8# 9TestName="exclude-dir-test" 10JobName=exclude-dir 11# Directory to backup. 12# This directory will be created by setup_data(). 13BackupDirectory="${tmp}/data" 14 15scripts/cleanup 16scripts/copy-test-confs 17 18cat >> $conf/bareos-dir.conf <<EOF 19FileSet { 20 Name = "ExcludeDir" 21 Include { 22 Exclude Dir Containing = ".nobkp" 23 Options { 24 signature=MD5 25 compression=GZIP 26 } 27 File = "$BackupDirectory" 28 } 29 Include { 30 Exclude Dir Containing = "bareos-dir.conf" 31 Options { 32 signature=MD5 33 compression=GZIP 34 } 35 File = "$conf" 36 File = "$rscripts" 37 File = "${BackupDirectory}/build/po" 38 } 39} 40EOF 41sed 's/FileSet="CompressedSet"/FileSet=ExcludeDir/' $conf/bareos-dir.conf >$tmp/1 42cp -f $tmp/1 $conf/bareos-dir.conf 43change_jobname CompressedTest $JobName 44 45# Use a tgz to setup data to be backuped. 46# Data will be placed at "${tmp}/data/". 47setup_data data/flat-c.tgz 48 49mkdir -p ${BackupDirectory}/build/po 50echo "test" > ${BackupDirectory}/build/po/fr.po 51mkdir -p ${BackupDirectory}/build/src/xxtestdir 52touch ${BackupDirectory}/build/src/xxtestdir/.nobkp 53cp ${BackupDirectory}/*.c ${BackupDirectory}/build/src/xxtestdir 54 55 56start_test 57 58cat >tmp/bconcmds <<END_OF_DATA 59@$out /dev/null 60messages 61@$out $tmp/log3.out 62estimate job=$JobName listing 63messages 64@$out $tmp/log1.out 65label storage=File volume=TestVolume001 66run job=$JobName yes 67wait 68messages 69@$out $tmp/log2.out 70restore where=${cwd}/tmp/bareos-restores select all storage=File done 71yes 72wait 73messages 74quit 75END_OF_DATA 76 77run_bareos 78check_for_zombie_jobs storage=File 79stop_bareos 80 81check_two_logs 82 83# should be ok if we remove the xxtestdir 84rm -rf ${BackupDirectory}/build/src/xxtestdir 85check_restore_diff ${BackupDirectory} 86 87grep '/xxtestdir' $tmp/log3.out > /dev/null 88if [ $? = 0 ]; then 89 print_debug "ERROR: Should not see xxtestdir in estimate output" 90 bstat=2 91fi 92 93# build/po is included 2 times with a different exclude file 94# we shouldn't see scripts and bin 95nb=`egrep -c 'build/po/fr.po$' $tmp/log3.out` 96if [ $nb != 2 ]; then 97 print_debug "ERROR: Should see fr.po two times" 98 bstat=2 99fi 100 101grep $rscripts $tmp/log3.out > /dev/null 102if [ $? = 0 ]; then 103 print_debug "ERROR: Should not $rscripts in estimate output" 104 bstat=2 105fi 106 107grep $conf $tmp/log3.out > /dev/null 108if [ $? = 0 ]; then 109 print_debug "ERROR: Should not $conf in estimate output" 110 bstat=2 111fi 112 113end_test 114