]> 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 failed!!! ===== "
11    echo "  ===== etc-test-root failed!!! ===== " >>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 bin/bacula stop 2>&1 >/dev/null
25 cd bin
26 ./drop_bacula_tables >/dev/null 2>&1
27 ./make_bacula_tables >/dev/null 2>&1
28 ./grant_bacula_privileges 2>&1 >/dev/null
29 cd ..
30 bin/bacula start 2>&1 >/dev/null
31 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
32 @output /dev/null
33 messages
34 @output tmp/log1.out
35 label storage=File
36 TestVolume001
37 run job=NightlySave
38 yes
39 wait
40 messages
41 @# 
42 @# now do a restore
43 @#
44 @output tmp/log2.out
45 restore where=${cwd}/tmp/bacula-restores select    
46 unmark *
47 mark *
48 done
49 yes
50 wait
51 messages
52 @output
53 quit
54 END_OF_DATA
55 bin/bacula stop 2>&1 >/dev/null
56 cd /
57 ${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test etc >${cwd}/tmp/1       
58 cd ${cwd}/tmp/bacula-restores
59 ${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test etc >${cwd}/tmp/2
60 sort <${cwd}/tmp/1 >${cwd}/tmp/original
61 sort <${cwd}/tmp/2 >${cwd}/tmp/restored
62 rm -f ${cwd}/tmp/1 ${cwd}/tmp/2
63 cd ${cwd}
64 diff tmp/original tmp/restored 2>&1 1>/dev/null
65 if [ $? != 0 ] ; then
66    echo " "
67    echo " "
68    echo "  ===== etc-test-root failed!!! ===== "
69    echo "  ===== etc-test-root failed!!! ===== " >>test.out
70    echo " "
71 else
72    echo "  ===== etc-test-root OK ===== "
73    echo "  ===== etc-test-root OK ===== " >>test.out
74    scripts/cleanup
75 fi