@@ -12,20 +12,19 @@ This program build Centreon-engine
12
12
-h|--help : help
13
13
EOF
14
14
}
15
- BUILD_TYPE=" Debug"
15
+ BUILD_TYPE=Debug
16
16
CONAN_REBUILD=" 0"
17
- for i in $( cat conanfile.txt ) ; do
18
- if [[ $i =~ / ]] ; then
19
- if [ ! -d ~ /.conan/data/$i ] ; then
20
- echo " The package '$i ' is missing"
21
- CONAN_REBUILD=" 1 "
17
+ while IFS= read -r filename ; do
18
+ if [[ $filename =~ / ]] ; then
19
+ if [ ! -d ~ /.conan/data/" $filename " ] ; then
20
+ echo " The package '$filename ' is missing"
21
+ CONAN_REBUILD=1
22
22
break
23
23
fi
24
24
fi
25
- done
25
+ done < conanfile.txt
26
26
27
- for i in " $@ "
28
- do
27
+ for i in " $@ " ; do
29
28
case $i in
30
29
-f|--force)
31
30
force=1
52
51
my_id=$( id -u)
53
52
54
53
if [ -r /etc/centos-release ] ; then
55
- maj=" centos$( cat /etc/centos-release | awk ' {print $4}' | cut -f1 -d' .' ) "
54
+ maj=" centos$( awk ' {print $4}' /etc/centos-release | cut -f1 -d' .' ) "
56
55
v=$( cmake --version)
57
56
if [[ $v =~ " version 3" ]] ; then
58
57
cmake=' cmake'
59
58
else
60
59
if rpm -q cmake3 ; then
61
- rm -f /usr/bin/cmake
62
- ln -s /usr/bin/cmake3 /usr/bin/cmake
63
- cmake=' cmake'
64
- elif [ $maj = " centos7" ] ; then
60
+ cmake=' cmake3'
61
+ elif [ " $maj " = " centos7" ] ; then
65
62
yum -y install epel-release cmake3
66
- mv /usr/bin/cmake /usr/bin/cmake2
67
- ln -s /usr/bin/cmake3 /usr/bin/cmake
68
- cmake=' cmake'
63
+ cmake=' cmake3'
69
64
else
70
65
dnf -y install cmake
71
66
cmake=' cmake'
@@ -84,8 +79,7 @@ if [ -r /etc/centos-release ] ; then
84
79
85
80
good=$( gcc --version | awk ' /gcc/ && ($3+0)>5.0{print 1}' )
86
81
87
- if [ ! $good ] ; then
88
- echo " Your compiler is too old. Trying to used devtoolset-9."
82
+ if [ ! " $good " ] ; then
89
83
yum -y install centos-release-scl
90
84
yum-config-manager --enable rhel-server-rhscl-7-rpms
91
85
yum -y install devtoolset-9
@@ -97,26 +91,26 @@ if [ -r /etc/centos-release ] ; then
97
91
perl-Thread-Queue
98
92
)
99
93
for i in " ${pkgs[@]} " ; do
100
- if ! rpm -q $i ; then
94
+ if ! rpm -q " $i " ; then
101
95
if [ $maj = ' centos7' ] ; then
102
- yum install -y $i
96
+ yum install -y " $i "
103
97
else
104
- dnf -y --enablerepo=PowerTools install $i
98
+ dnf -y --enablerepo=PowerTools install " $i "
105
99
fi
106
100
fi
107
101
done
108
102
elif [ -r /etc/issue ] ; then
109
- maj=$( cat /etc/issue | awk ' {print $1}' )
110
- version=$( cat /etc/issue | awk ' {print $3}' )
111
- if [ $version = " 9" ] ; then
112
- dpkg=' dpkg'
103
+ maj=$( awk ' {print $1}' /etc/issue )
104
+ version=$( awk ' {print $3}' /etc/issue )
105
+ if [ " $version " = " 9" ] ; then
106
+ dpkg=" dpkg"
113
107
else
114
108
dpkg=' dpkg --no-pager'
115
109
fi
116
110
v=$( cmake --version)
117
- if [[ $v =~ " version 3" ]] ; then
111
+ if [[ " $v " =~ " version 3" ]] ; then
118
112
cmake=' cmake'
119
- elif [ $maj = " Debian" ] || [ $maj = " Ubuntu" ] ; then
113
+ elif [ " $maj " = " Debian" ] || [ " $maj " = " Ubuntu" ] ; then
120
114
if $dpkg -l cmake ; then
121
115
echo " Bad version of cmake..."
122
116
exit 1
@@ -129,7 +123,7 @@ elif [ -r /etc/issue ] ; then
129
123
exit 1
130
124
fi
131
125
fi
132
- elif [ $maj = " Raspbian" ] ; then
126
+ elif [ " $maj " = " Raspbian" ] ; then
133
127
if $dpkg -l cmake ; then
134
128
echo " Bad version of cmake..."
135
129
exit 1
@@ -146,7 +140,7 @@ elif [ -r /etc/issue ] ; then
146
140
echo " Bad version of cmake..."
147
141
exit 1
148
142
fi
149
- if [ $maj = " Debian" ] || [ $maj = " Ubuntu" ]; then
143
+ if [ " $maj " = " Debian" ] || [ " $maj " = " Ubuntu" ]; then
150
144
pkgs=(
151
145
gcc
152
146
g++
@@ -165,8 +159,7 @@ elif [ -r /etc/issue ] ; then
165
159
fi
166
160
fi
167
161
done
168
- fi
169
- if [ $maj = " Raspbian" ] ; then
162
+ elif [ " $maj " = " Raspbian" ] ; then
170
163
pkgs=(
171
164
gcc
172
165
g++
190
183
191
184
pip3 install conan --upgrade
192
185
193
- if [ $my_id -eq 0 ] ; then
186
+ if [ " $my_id " -eq 0 ] ; then
194
187
conan=' /usr/local/bin/conan'
195
188
elif which conan ; then
196
189
conan=$( which conan)
@@ -204,15 +197,15 @@ else
204
197
echo " 'build' directory already there"
205
198
fi
206
199
207
- if [ " $force " = " 1 " ] ; then
200
+ if [ " $force " = 1 ] ; then
208
201
rm -rf build
209
202
mkdir build
210
203
fi
211
204
cd build
212
205
213
- if [ $maj = " centos7" ] ; then
206
+ if [ " $maj " = centos7 ] ; then
214
207
rm -rf ~ /.conan/profiles/default
215
- if [ " $CONAN_REBUILD " = " 1 " ] ; then
208
+ if [ " $CONAN_REBUILD " = 1 ] ; then
216
209
$conan install .. -s compiler.libcxx=libstdc++11 --build=" *"
217
210
else
218
211
$conan install .. -s compiler.libcxx=libstdc++11 --build=missing
0 commit comments