]> git.sur5r.net Git - bacula/bacula/blob - gui/baculum/examples/rpm/baculum.spec
baculum: New Baculum API and Baculum Web
[bacula/bacula] / gui / baculum / examples / rpm / baculum.spec
1 %global langs en pl
2 %global destdir build
3 %global metaname baculum
4
5 Summary:        API layer to Baculum WebGUI tool for Bacula Community program
6 Name:           baculum
7 Version:        7.9.0
8 Release:        1%{?dist}
9 License:        AGPLv3
10 Group:          Applications/Internet
11 URL:            http://bacula.org/
12 Source0:        bacula-gui-7.9.0.tar.gz
13 BuildRequires:  systemd-units
14 BuildRequires:  checkpolicy
15 Requires:       bacula-console
16 # Lower version of PHP ( < 5.3.4) does not provide php-mysqlnd db driver
17 # and from this reason the lowest is 5.3.4
18 Requires:       php >= 5.3.4
19 Requires:       php-bcmath
20 Requires:       php-common
21 Requires:       php-mbstring
22 Requires:       php-mysqlnd
23 Requires:       php-pdo
24 Requires:       php-pgsql
25 Requires:       php-xml
26 BuildArch:      noarch
27
28 %description
29 The Baculum program allows the user to administer and manage Bacula jobs.
30 By using Baculum it is possible to execute backup/restore operations, monitor
31 current Bacula jobs, configure Bacula, media management and others. Baculum has
32 integrated web console that communicates with Bacula bconsole program.
33
34 %package common
35 Summary:                Common libraries for Baculum
36 Group:                  Applications/Internet
37
38 %description common
39 This package provides the common libraries for Baculum.
40 This module is a part of Baculum.
41
42 %package api
43 Summary:                Baculum API files
44 Requires:               %name-common = %version-%release
45 Group:                  Applications/Internet
46 Requires:               bacula-console
47 # Lower version of PHP ( < 5.3.4) does not provide php-mysqlnd db driver
48 # and from this reason the lowest is 5.3.4
49 Requires:               php >= 5.3.4
50 Requires:               php-bcmath
51 Requires:               php-common
52 Requires:               php-mysqlnd
53 Requires:               php-pdo
54 Requires:               php-pgsql
55 Requires:               php-xml
56
57 %description api
58 This package provides the API files for Baculum.
59 This module is a part of Baculum.
60
61 %package web
62 Summary:                Baculum API files
63 Requires:               %name-common = %version-%release
64 Group:                  Applications/Internet
65 # Lower version of PHP ( < 5.3.4) does not provide php-mysqlnd db driver
66 # and from this reason the lowest is 5.3.4
67 Requires:               php >= 5.3.4
68 Requires:               php-common
69 Requires:               php-mbstring
70 Requires:               php-xml
71
72 %description web
73 This package provides the Web files for Baculum.
74 This module is a part of Baculum.
75
76 %package api-httpd
77 Summary:                Apache configuration for Baculum API
78 Requires:               %name-api = %version-%release
79 Group:                  Applications/Internet
80 Requires:               httpd
81 # This conflict field is required because Lighttpd and Apache
82 # cannot listen on the same port at the same time. Even using diffeernt
83 # ports cause problems like shared framework cache and
84 # web server specific directories permissions (for lighttpd and apache
85 # users).
86 Conflicts:              %{name}-api-lighttpd, %{name}-web-lighttpd
87
88 %description api-httpd
89 This package provides the Apache configuration for Baculum API.
90 By using this module it is possible to run Baculum API in Apache environment.
91
92 %package api-lighttpd
93 Summary:                Lighttpd configuration for Baculum API
94 Requires:               %name-api = %version-%release
95 Group:                  Applications/Internet
96 Requires:               lighttpd
97 Requires:               lighttpd-fastcgi
98 # This conflict field is required because Lighttpd and Apache
99 # cannot listen on the same port at the same time. Even using diffeernt
100 # ports cause problems like shared framework cache and
101 # web server specific directories permissions (for lighttpd and apache
102 # users).
103 Conflicts:              %{name}-api-httpd, %{name}-web-httpd
104
105 %description api-lighttpd
106 This package provides the Lighttpd configuration for Baculum API.
107 By using this module it is possible to run Baculum API in Lighttpd environment.
108
109 %package web-httpd
110 Summary:                Apache configuration for Baculum WebGUI
111 Requires:               %name-web = %version-%release
112 Group:                  Applications/Internet
113 Requires:               httpd
114 # This conflict field is required because Lighttpd and Apache
115 # cannot listen on the same port at the same time. Even using diffeernt
116 # ports cause problems like shared framework cache and
117 # web server specific directories permissions (for lighttpd and apache
118 # users).
119 Conflicts:              %{name}-web-lighttpd, %{name}-api-lighttpd
120
121 %description web-httpd
122 This package provides the Apache configuration for Baculum WebGUI.
123 By using this module it is possible to run Baculum WebGUI in Apache environment.
124
125 %package web-lighttpd
126 Summary:                Lighttpd configuration for Baculum WebGUI
127 Requires:               %name-web = %version-%release
128 Group:                  Applications/Internet
129 Requires:               lighttpd
130 Requires:               lighttpd-fastcgi
131 # This conflict field is required because Lighttpd and Apache
132 # cannot listen on the same port at the same time. Even using diffeernt
133 # ports cause problems like shared framework cache and
134 # web server specific directories permissions (for lighttpd and apache
135 # users).
136 Conflicts:              %{name}-web-httpd, %{name}-api-httpd
137
138 %description web-lighttpd
139 This package provides the Lighttpd configuration for Baculum WebGUI.
140 By using this module it is possible to run Baculum WebGUI in Lighttpd environment.
141
142 %prep
143 %setup -n bacula-gui-%version/baculum
144
145 %build
146 # Execute files preparation in build directory by Makefile
147 make build DESTDIR=%{destdir}
148 # Remove these cache directories, because here will be symbolic links
149 rmdir %{destdir}/%{_datadir}/%{metaname}/htdocs/assets
150 rmdir %{destdir}/%{_datadir}/%{metaname}/htdocs/protected/runtime
151 for lang in  %{langs}; do
152         rm %{destdir}/%{_datadir}/%{metaname}/htdocs/protected/API/Lang/${lang}/messages.mo
153         rm %{destdir}/%{_datadir}/%{metaname}/htdocs/protected/Web/Lang/${lang}/messages.mo
154 done
155
156 %install
157 cp -ra build/. %{buildroot}
158 %find_lang %{metaname} --all-name
159
160 %post common
161 # these symbolic links indicates to Baculum's cache directory
162 ln -s  %{_localstatedir}/cache/%{metaname} %{_datadir}/%{metaname}/htdocs/assets
163 ln -s  %{_localstatedir}/cache/%{metaname} %{_datadir}/%{metaname}/htdocs/protected/runtime
164
165 %post api
166 # because framework does not use system locale dir, here are linked
167 # locale files to framework location
168 for lang in  %{langs}; do
169         ln -s  %{_datadir}/locale/${lang}/LC_MESSAGES/%{metaname}-api.mo \
170                 %{_datadir}/%{metaname}/htdocs/protected/API/Lang/${lang}/messages.mo
171 done
172
173 %post web
174 # because framework does not use system locale dir, here are linked
175 # locale files to framework location
176 for lang in  %{langs}; do
177         ln -s  %{_datadir}/locale/${lang}/LC_MESSAGES/%{metaname}-web.mo \
178                 %{_datadir}/%{metaname}/htdocs/protected/Web/Lang/${lang}/messages.mo
179 done
180
181 %post api-httpd
182 %systemd_post httpd.service
183 ln -s  %{_sysconfdir}/%{metaname}/Config-api-apache %{_datadir}/%{metaname}/htdocs/protected/API/Config
184
185 %post api-lighttpd
186 %systemd_post baculum-api-lighttpd.service
187 ln -s  %{_sysconfdir}/%{metaname}/Config-api-lighttpd %{_datadir}/%{metaname}/htdocs/protected/API/Config
188
189 %post web-httpd
190 %systemd_post httpd.service
191 ln -s  %{_sysconfdir}/%{metaname}/Config-web-apache %{_datadir}/%{metaname}/htdocs/protected/Web/Config
192
193 %post web-lighttpd
194 %systemd_post baculum-web-lighttpd.service
195 ln -s  %{_sysconfdir}/%{metaname}/Config-web-lighttpd %{_datadir}/%{metaname}/htdocs/protected/Web/Config
196
197 %preun common
198 rm %{_datadir}/%{metaname}/htdocs/assets
199 rm %{_datadir}/%{metaname}/htdocs/protected/runtime
200
201 %preun api
202 for lang in  %{langs}; do
203         rm %{_datadir}/%{metaname}/htdocs/protected/API/Lang/${lang}/messages.mo
204 done
205
206 %preun web
207 for lang in  %{langs}; do
208         rm %{_datadir}/%{metaname}/htdocs/protected/Web/Lang/${lang}/messages.mo
209 done
210
211 %preun api-httpd
212 %systemd_preun httpd.service
213 if [ $1 -lt 1 ] ; then
214         # Rename settings if exist.
215         # Note, 'config' macro cannot be used because this file is created after successful
216         # installation via wizard. Also using 'config' macro to /usr location strictly forbidden
217         # by Packaging Guidelines.
218         [ ! -e %{_datadir}/%{metaname}/htdocs/protected/API/Config/api.conf ] ||
219                 mv %{_datadir}/%{metaname}/htdocs/protected/API/Config/api.conf \
220                 %{_datadir}/%{metaname}/htdocs/protected/API/Config/api.conf.apache
221         # remove debug files if any
222         [ ! -e %{_datadir}/%{metaname}/htdocs/protected/API/Logs/baculum-api.log ] ||
223                 rm %{_datadir}/%{metaname}/htdocs/protected/API/Logs/baculum-api*.log
224         rm %{_datadir}/%{metaname}/htdocs/protected/API/Config
225 fi
226
227 %preun web-httpd
228 %systemd_preun httpd.service
229 if [ $1 -lt 1 ] ; then
230         # Rename settings if exist.
231         # Note, 'config' macro cannot be used because this file is created after successful
232         # installation via wizard. Also using 'config' macro to /usr location strictly forbidden
233         # by Packaging Guidelines.
234         [ ! -e %{_datadir}/%{metaname}/htdocs/protected/Web/Config/settings.conf ] ||
235                 mv %{_datadir}/%{metaname}/htdocs/protected/Web/Config/settings.conf \
236                 %{_datadir}/%{metaname}/htdocs/protected/Web/Config/settings.conf.apache
237         [ ! -e %{_datadir}/%{metaname}/htdocs/protected/Web/Config/hosts.conf ] ||
238                 mv %{_datadir}/%{metaname}/htdocs/protected/Web/Config/hosts.conf \
239                 %{_datadir}/%{metaname}/htdocs/protected/Web/Config/hosts.conf.apache
240         # remove debug files if any
241         [ ! -e %{_datadir}/%{metaname}/htdocs/protected/Web/Logs/baculum-web.log ] ||
242                 rm %{_datadir}/%{metaname}/htdocs/protected/Web/Logs/baculum-web*.log
243         rm %{_datadir}/%{metaname}/htdocs/protected/Web/Config
244 fi
245
246 %preun api-lighttpd
247 %systemd_preun baculum-api-lighttpd.service
248 if [ $1 -lt 1 ] ; then
249         # stop api service
250         /sbin/service baculum-api-lighttpd stop &>/dev/null || :
251         # Rename settings if exist.
252         # Note, 'config' macro cannot be used because this file is created after successful
253         # installation via wizard. Also using 'config' macro to /usr location strictly forbidden
254         # by Packaging Guidelines.
255         [ ! -e %{_datadir}/%{metaname}/htdocs/protected/API/Config/api.conf ] ||
256                 mv %{_datadir}/%{metaname}/htdocs/protected/API/Config/api.conf \
257                 %{_datadir}/%{metaname}/htdocs/protected/API/Config/api.conf.lighttpd
258         # remove debug files if any
259         [ ! -e %{_datadir}/%{metaname}/htdocs/protected/API/Logs/baculum-api.log ] ||
260                 rm %{_datadir}/%{metaname}/htdocs/protected/API/Logs/baculum-api*.log
261         rm %{_datadir}/%{metaname}/htdocs/protected/API/Config
262 fi
263
264 %preun web-lighttpd
265 %systemd_preun baculum-web-lighttpd.service
266 if [ $1 -lt 1 ] ; then
267         # stop web service
268         /sbin/service baculum-web-lighttpd stop &>/dev/null || :
269         # Rename settings if exist.
270         # Note, 'config' macro cannot be used because this file is created after successful
271         # installation via wizard. Also using 'config' macro to /usr location strictly forbidden
272         # by Packaging Guidelines.
273         [ ! -e %{_datadir}/%{metaname}/htdocs/protected/Web/Config/settings.conf ] ||
274                 mv %{_datadir}/%{metaname}/htdocs/protected/Web/Config/settings.conf \
275                 %{_datadir}/%{metaname}/htdocs/protected/Web/Config/settings.conf.lighttpd
276         [ ! -e %{_datadir}/%{metaname}/htdocs/protected/Web/Config/hosts.conf ] ||
277                 mv %{_datadir}/%{metaname}/htdocs/protected/Web/Config/hosts.conf \
278                 %{_datadir}/%{metaname}/htdocs/protected/Web/Config/hosts.conf.lighttpd
279         # remove debug files if any
280         [ ! -e %{_datadir}/%{metaname}/htdocs/protected/Web/Logs/baculum-web.log ] ||
281                 rm %{_datadir}/%{metaname}/htdocs/protected/Web/Logs/baculum-web*.log
282         rm %{_datadir}/%{metaname}/htdocs/protected/Web/Config
283 fi
284
285 %postun api-httpd
286 %systemd_postun_with_restart httpd.service
287
288 %postun web-httpd
289 %systemd_postun_with_restart httpd.service
290
291 %postun api-lighttpd
292 %systemd_postun_with_restart baculum-api-lighttpd.service
293
294 %postun web-lighttpd
295 %systemd_postun_with_restart baculum-web-lighttpd.service
296
297 %files -f %{metaname}.lang common
298 %defattr(-,root,root)
299 %{_datadir}/%{metaname}/htdocs/protected/Common
300 %{_datadir}/%{metaname}/htdocs/protected/application.xml
301 %{_datadir}/%{metaname}/htdocs/framework
302 %{_datadir}/%{metaname}/htdocs/themes
303 %{_datadir}/%{metaname}/htdocs/LICENSE
304 %{_datadir}/%{metaname}/htdocs/AUTHORS
305 %{_datadir}/%{metaname}/htdocs/README
306 %{_datadir}/%{metaname}/htdocs/INSTALL
307 %{_datadir}/%{metaname}/htdocs/index.php
308 %license LICENSE
309 %doc AUTHORS README
310
311
312 %files api
313 %defattr(-,root,root)
314 # directory excluded here, because it needs to be provided
315 # with selected web server privileges (lighttpd or apache)
316 %exclude %{_datadir}/%{metaname}/htdocs/protected/API/Config
317 %exclude %{_datadir}/%{metaname}/htdocs/protected/API/Logs
318 %{_datadir}/%{metaname}/htdocs/protected/API
319
320 %files web
321 %defattr(-,root,root)
322 # directory excluded here, because it needs to be provided
323 # with selected web server privileges (lighttpd or apache)
324 %exclude %{_datadir}/%{metaname}/htdocs/protected/Web/Config
325 %exclude %{_datadir}/%{metaname}/htdocs/protected/Web/Logs
326 %{_datadir}/%{metaname}/htdocs/protected/Web
327
328
329 %files api-httpd
330 %defattr(644,root,root)
331 # directory excluded here, because it needs to be provided
332 # with selected web server privileges (lighttpd or apache)
333 %exclude %{_datadir}/%{metaname}/htdocs/protected/API/Config
334 # Apache logs are stored in /var/log/httpd/
335 %config(noreplace) %{_sysconfdir}/httpd/conf.d/%{metaname}-api.conf
336 %attr(755,apache,apache) %{_localstatedir}/cache/%{metaname}/
337 %attr(700,apache,apache) %{_sysconfdir}/%{metaname}/Config-api-apache/
338 %attr(600,apache,apache) %{_sysconfdir}/%{metaname}/Config-api-apache/%{metaname}.users
339 %attr(755,apache,apache) %{_datadir}/%{metaname}/htdocs/protected/API/Logs
340
341 %files web-httpd
342 %defattr(644,root,root)
343 # directory excluded here, because it needs to be provided
344 # with selected web server privileges (lighttpd or apache)
345 %exclude %{_datadir}/%{metaname}/htdocs/protected/Web/Config
346 # Apache logs are stored in /var/log/httpd/
347 %config(noreplace) %{_sysconfdir}/httpd/conf.d/%{metaname}-web.conf
348 %attr(755,apache,apache) %{_localstatedir}/cache/%{metaname}/
349 %attr(700,apache,apache) %{_sysconfdir}/%{metaname}/Config-web-apache/
350 %attr(600,apache,apache) %{_sysconfdir}/%{metaname}/Config-web-apache/%{metaname}.users
351 %attr(755,apache,apache) %{_datadir}/%{metaname}/htdocs/protected/Web/Logs
352
353 %files api-lighttpd
354 %defattr(644,root,root)
355 # Lighttpd logs are stored in /var/log/lighttpd
356 %attr(755,lighttpd,lighttpd) %{_localstatedir}/cache/%{metaname}/
357 %attr(700,lighttpd,lighttpd) %{_sysconfdir}/%{metaname}/Config-api-lighttpd/
358 %attr(600,lighttpd,lighttpd) %{_sysconfdir}/%{metaname}/Config-api-lighttpd/%{metaname}.users
359 %attr(755,lighttpd,lighttpd) %{_datadir}/%{metaname}/htdocs/protected/API/Logs
360 %{_unitdir}/%{metaname}-api-lighttpd.service
361 %config(noreplace) %{_sysconfdir}/%{metaname}/%{metaname}-api-lighttpd.conf
362
363 %files web-lighttpd
364 %defattr(644,root,root)
365 # Lighttpd logs are stored in /var/log/lighttpd
366 %attr(755,lighttpd,lighttpd) %{_localstatedir}/cache/%{metaname}/
367 %attr(700,lighttpd,lighttpd) %{_sysconfdir}/%{metaname}/Config-web-lighttpd/
368 %attr(600,lighttpd,lighttpd) %{_sysconfdir}/%{metaname}/Config-web-lighttpd/%{metaname}.users
369 %attr(755,lighttpd,lighttpd) %{_datadir}/%{metaname}/htdocs/protected/Web/Logs
370 %{_unitdir}/%{metaname}-web-lighttpd.service
371 %config(noreplace) %{_sysconfdir}/%{metaname}/%{metaname}-web-lighttpd.conf
372
373 %changelog
374  * Sat Dec 10 2016 Marcin Haba <marcin.haba@bacula.pl> - 7.5.0-0.1
375  - Spec create