This repository has been archived by the owner on Mar 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
setup
executable file
·126 lines (108 loc) · 2.25 KB
/
setup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/bin/sh
#
# Script to setup running Bareos regression tests
#
check_exit_code()
{
if [ $? != 0 ] ; then
echo "Bad exit code giving up"
exit 1
fi
}
. ./config
cwd=`pwd`
if [ ! -d ${BAREOS_SOURCE} ] ; then
echo "The BAREOS_SOURCE environment variable must be a Bareos release directory, but is not."
echo " "
exit 1
fi
MAKEOPTS=${MAKEOPT:-"-j3"}
#
# We build and setup binaries to the $cwd/bin directory not $bin
#
rm -rf build bin
#
# See if this is a git clone
#
if [ -f .git/config ] && type git >/dev/null 2>&1; then
#
# See if we have git available.
#
git pull
fi
#
# Copy the source
#
echo "Copying source from ${BAREOS_SOURCE}"
cp -rp ${BAREOS_SOURCE} build
if [ -f build/.git/config ] && type git >/dev/null 2>&1; then
#
# update bareos sources
#
(
cd build;
git pull;
git show HEAD | grep commit | head -1 | awk '{print $2}' > git-version
)
else
echo "Git not available." > build/git-version
fi
scripts/create_sed
#
# Now turn on DEVELOPER for regression testing
#
echo "s%^.*define DEVELOPER 1.*$%#define DEVELOPER 1%g" >tmp/t$$
sed -f tmp/t$$ build/src/include/version.h >tmp/o$$
cp tmp/o$$ build/src/include/version.h
#
# Remove unneeded directories
#
rm -rf build/txt build/src/testprogs
#rm -rf build/.git
sed -f tmp/sed_tmp scripts/regress-config.in >scripts/regress-config
chmod 755 scripts/regress-config
cp scripts/regress-config build
cd build
rm -f Makefile config.*
#
# Run Bareos configuration, make, install
#
./regress-config ${cwd}
check_exit_code
#
# Cleanup any build in source
#
make clean
make ${MAKEOPT}
check_exit_code
make install
if [ a${KEEP_SOURCE} = a ]; then
rm -rf examples patches
check_exit_code
# eliminate non-essential directories to reduce
# size. Otherwise regress run too long
rm -rf src/win32 examples patches
fi
#
# Get all tests -- especially testls
#
cd src/tests
make installall
check_exit_code
cd ../..
#
# Get all tools -- especially timelimit
#
cd src/tools
make installall
check_exit_code
cd ${cwd}
bin/bareos stop
mkdir -p working
cd bin
echo "Running database creation scripts"
./create_bareos_database ${DBTYPE}
./drop_bareos_tables ${DBTYPE}
./make_bareos_tables ${DBTYPE}
./grant_bareos_privileges ${DBTYPE}
cd ${cwd}