]> git.sur5r.net Git - bacula/bacula/blob - regress/scripts/setup
Use BUILD_DIR in default conf
[bacula/bacula] / regress / scripts / setup
1 #!/bin/sh
2 #
3 # Script to setup running Bacula regression tests
4 #
5
6 check_exit_code()
7 {
8    if [ $? != 0 ] ; then
9       echo "Bad exit code giving up"
10       exit 1 
11    fi
12 }
13
14 . ./config
15
16 cwd=`pwd`
17 if [ ! -d ${BACULA_SOURCE} ] ; then
18    echo "The BACULA_SOURCE environment variable must be a Bacula release directory, but is not."
19    echo " "
20    exit 1
21 fi
22
23 # we build and setup binaries to the $cwd/bin directory not $bin
24 rm -rf build bin
25 # Copy new source
26 echo "Copying source from ${BACULA_SOURCE}"
27 cp -rp ${BACULA_SOURCE} build
28 scripts/create_sed
29 # In default bacula-dir.conf.in, change default file 
30 # to backup to be build directory
31 echo "s%File = @sbindir@%File = @BUILD_DIR@%g" >tmp/t$$
32 sed -f tmp/t$$ build/src/dird/bacula-dir.conf.in >tmp/o$$
33 cp tmp/o$$ build/src/dird/bacula-dir.conf.in
34 rm -f tmp/t$$ tmp/o$$
35 # remove unneeded directories
36 rm -rf build/txt build/src/testprogs
37 sed -f tmp/sed_tmp scripts/regress-config.in >scripts/regress-config
38 chmod 755 scripts/regress-config
39 cp scripts/regress-config build
40 cd build
41 rm -f Makefile config.cache
42 # Run Bacula configuration, make, install
43 ./regress-config ${cwd}
44 check_exit_code
45 # Cleanup any build in source
46 make clean
47 make -j3
48 check_exit_code
49 make install
50 rm -rf examples patches
51 check_exit_code
52 # eliminate non-essential directories to reduce
53 #   size.  Otherwise regress run too long
54 rm -rf src/win32 examples patches
55 cp src/tools/testls ../bin
56 check_exit_code
57
58 cd ${cwd}
59 bin/bacula stop
60
61 mkdir -p working
62 cd bin
63 echo "Running database creation scripts"
64 ./create_bacula_database
65 ./drop_bacula_tables
66 ./make_bacula_tables
67 ./grant_bacula_privileges
68 cd ${cwd}
69 # Start and stop Bacula to ensure conf files are OK
70 bin/bacula start
71 bin/bacula stop
72 #
73 # Save Bacula default conf files for later use
74 #
75 cp -f bin/*.conf scripts