]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/lib-test-root
Final changes
[bacula/bacula] / regress / tests / lib-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 "  ===== !!!! lib-test-root not run !!!! ===== "
11    echo "  ===== !!!! lib-test-root not run !!!! ===== " >>test.out
12    echo " "
13    exit 1
14 fi
15 cwd=`pwd`
16 scripts/copy-test-confs
17 scripts/cleanup
18 echo "/lib" >/tmp/file-list
19
20 echo " "
21 echo " "
22 echo " === Starting /lib save/restore test ==="
23 echo " "
24 echo " "
25
26 bin/bacula start 2>&1 >/dev/null
27 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
28 @output /dev/null
29 messages
30 @output tmp/log1.out
31 label storage=File
32 TestVolume001
33 run job=NightlySave
34 yes
35 wait
36 messages
37 @# 
38 @# now do a restore
39 @#
40 @output tmp/log2.out
41 restore where=${cwd}/tmp/bacula-restores select    
42 unmark *
43 mark *
44 done
45 yes
46 wait
47 messages
48 @output
49 quit
50 END_OF_DATA
51 bin/bacula stop 2>&1 >/dev/null
52 cd /
53 ${cwd}/bin/testls -e ${cwd}/scripts/exclude-lib-test lib >${cwd}/tmp/original
54 cd ${cwd}/tmp/bacula-restores
55 ${cwd}/bin/testls -e ${cwd}/scripts/exclude-lib-test lib >${cwd}/tmp/restored
56 cd ${cwd}/tmp
57 sed s%.*lib/kbd/consolefonts$%lib/kbd/consolefonts% original >1
58 sort <1 >original
59 #
60 sed s%.*lib/kbd/consolefonts$%lib/kbd/consolefonts% restored >1
61 sort <1 >restored
62 rm -f 1
63 #
64 cd ${cwd}
65 diff tmp/original tmp/restored 2>&1 1>/dev/nul
66 if [ $? != 0 ] ; then
67    echo " "
68    echo " "
69    echo "  ===== !!!! lib-test-root failed !!!! ===== "
70    echo "  ===== !!!! lib-test-root failed !!!! ===== " >>test.out
71    echo " "
72 else
73    echo "  ===== lib-test-root OK ===== "
74    echo "  ===== lib-test-root OK ===== " >>test.out
75    scripts/cleanup
76 fi