]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/etc-test-root
Final changes
[bacula/bacula] / regress / tests / etc-test-root
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory
4 #   then restore it.
5 #
6 MUID=`/usr/bin/id -u`
7 if [ $MUID != 0 ] ; then
8    echo " "
9    echo "You must be root to run this test."
10    echo "  ===== !!!! etc-test-root not run !!!! ===== "
11    echo "  ===== !!!! etc-test-root not run !!!! ===== " >>test.out
12    echo " "
13    exit 1
14 fi
15 echo " "
16 echo " "
17 echo " === Starting /etc save/restore test ==="
18 echo " "
19 echo " "
20 cwd=`pwd`
21 scripts/copy-test-confs
22 scripts/cleanup
23 echo "/etc" >/tmp/file-list
24
25 bin/bacula start 2>&1 >/dev/null
26 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
27 @output /dev/null
28 messages
29 @output tmp/log1.out
30 label storage=File
31 TestVolume001
32 run job=NightlySave
33 yes
34 wait
35 messages
36 @# 
37 @# now do a restore
38 @#
39 @output tmp/log2.out
40 restore where=${cwd}/tmp/bacula-restores select    
41 unmark *
42 mark *
43 done
44 yes
45 wait
46 messages
47 @output
48 quit
49 END_OF_DATA
50 bin/bacula stop 2>&1 >/dev/null
51 cd /
52 ${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test etc >${cwd}/tmp/1       
53 cd ${cwd}/tmp/bacula-restores
54 ${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test etc >${cwd}/tmp/2
55 sort <${cwd}/tmp/1 >${cwd}/tmp/original
56 sort <${cwd}/tmp/2 >${cwd}/tmp/restored
57 rm -f ${cwd}/tmp/1 ${cwd}/tmp/2
58 cd ${cwd}
59 diff tmp/original tmp/restored 2>&1 1>/dev/null
60 if [ $? != 0 ] ; then
61    echo " "
62    echo " "
63    echo "  ===== !!!! etc-test-root failed !!!! ===== "
64    echo "  ===== !!!! etc-test-root failed !!!! ===== " >>test.out
65    echo " "
66 else
67    echo "  ===== etc-test-root OK ===== "
68    echo "  ===== etc-test-root OK ===== " >>test.out
69    scripts/cleanup
70 fi