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