]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/lib-test-root
Make FreeBSD config correctly for tapes
[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 failed!!! ===== "
11    echo "  ===== lib-test-root failed!!! ===== " >>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 bin/bacula stop 2>&1 >/dev/null
20 bin/drop_sqlite_tables
21 bin/make_sqlite_tables
22 echo " "
23 echo " "
24 echo " === Starting /lib save/restore test ==="
25 echo " "
26 echo " "
27 bin/bacula start 2>&1 >/dev/null
28 bin/console -c bin/console.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-lib-test lib >${cwd}/tmp/original
52 cd ${cwd}/tmp/bacula-restores
53 ${cwd}/bin/testls -e ${cwd}/scripts/exclude-lib-test lib >${cwd}/tmp/restored
54 cd ${cwd}/tmp
55 sed s%.*lib/kbd/consolefonts$%lib/kbd/consolefonts% original >1
56 sort <1 >original
57 #
58 sed s%.*lib/kbd/consolefonts$%lib/kbd/consolefonts% restored >1
59 sort <1 >restored
60 rm -f 1
61 #
62 cd ${cwd}
63 diff tmp/original tmp/restored 2>&1 1>/dev/nul
64 if [ $? != 0 ] ; then
65    echo " "
66    echo " "
67    echo "  ===== lib-test-root failed!!! ===== "
68    echo "  ===== lib-test-root failed!!! ===== " >>test.out
69    echo " "
70 else
71    echo "  ===== lib-test-root OK ===== "
72    echo "  ===== lib-test-root OK ===== " >>test.out
73    scripts/cleanup
74 fi