]> git.sur5r.net Git - bacula/bacula/blob - regress/scripts/setup
Fix CentOS detection in regression get-os script
[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 which git >/dev/null 2>/dev/null
29 if [ $? = 0 ] ; then
30   git show HEAD | grep -m 1 commit | awk '{print $2}' > build/git-version
31 else
32   echo "Git not found." >build/git-version
33 fi
34 scripts/create_sed
35 # In default bacula-dir.conf.in, change default file 
36 # to backup to be build directory
37 echo "s%File = @sbindir@%File = @BUILD_DIR@%g" >tmp/t$$
38 sed -f tmp/t$$ build/src/dird/bacula-dir.conf.in >tmp/o$$
39 cp tmp/o$$ build/src/dird/bacula-dir.conf.in
40 rm -f tmp/t$$ tmp/o$$
41 # remove unneeded directories
42 rm -rf build/txt build/src/testprogs
43 sed -f tmp/sed_tmp scripts/regress-config.in >scripts/regress-config
44 chmod 755 scripts/regress-config
45 cp scripts/regress-config build
46 cd build
47 rm -f Makefile config.*
48 # Run Bacula configuration, make, install
49 ./regress-config ${cwd}
50 check_exit_code
51 # Cleanup any build in source
52 make clean
53 make -j3
54 check_exit_code
55 make install
56 rm -rf examples patches
57 check_exit_code
58 # eliminate non-essential directories to reduce
59 #   size.  Otherwise regress run too long
60 rm -rf src/win32 examples patches
61 # get all tools -- especially testls
62 cd src/tools
63 make installall
64 check_exit_code
65
66 cd ${cwd}
67 bin/bacula stop
68
69 mkdir -p working
70 cd bin
71 echo "Running database creation scripts"
72 ./create_bacula_database
73 ./drop_bacula_tables
74 ./make_bacula_tables
75 ./grant_bacula_privileges
76 cd ${cwd}
77 # Start and stop Bacula to ensure conf files are OK
78 bin/bacula start
79 bin/bacula stop
80 #
81 # Save Bacula default conf files for later use
82 #
83 cp -f bin/*.conf scripts