]> git.sur5r.net Git - bacula/bacula/blob - gui/baculum/examples/rpm/baculum.spec
ed44b79889eafca668223642cd0a56ebdeeb7fdd
[bacula/bacula] / gui / baculum / examples / rpm / baculum.spec
1 %global langs en pl
2 %global destdir build
3
4 Summary:        WebGUI tool for Bacula Community program
5 Name:           baculum
6 Version:        7.2.0
7 Release:        0%{?dist}
8 License:        AGPLv3
9 Group:          Applications/Internet
10 URL:            http://bacula.org/
11 Source0:        bacula-gui-7.2.0.tar.gz
12 BuildRequires:  systemd-units
13 BuildRequires:  selinux-policy
14 BuildRequires:  selinux-policy-devel
15 BuildRequires:  checkpolicy
16 Requires:       bacula-console
17 # Lower version of PHP ( < 5.3.4) does not provide php-mysqlnd db driver
18 # and from this reason the lowest is 5.3.4
19 Requires:       php >= 5.3.4
20 Requires:       php-bcmath
21 Requires:       php-common
22 Requires:       php-mbstring
23 Requires:       php-mysqlnd
24 Requires:       php-pdo
25 Requires:       php-pgsql
26 Requires:       php-xml
27 BuildArch:      noarch
28
29 %description
30 The Baculum program allows the user to administer and manage Bacula jobs.
31 By using Baculum it is possible to execute backup/restore operations, monitor
32 current Bacula jobs, media management and others. Baculum has integrated web
33 console that communicates with Bacula bconsole program.
34
35 %package selinux
36 Summary:                SELinux module for Baculum WebGUI tool
37 Requires:               %name = %version-%release
38 Group:                  Applications/Internet
39 Requires(post):         policycoreutils-python
40 Requires(preun):        policycoreutils-python
41
42 %description selinux
43 This package provides an SELinux module for Baculum WebGUI tool.
44 You should install this package if you are using SELinux, that Baculum
45 can be run in enforcing mode.
46
47 %package httpd
48 Summary:                Apache configuration for Baculum WebGUI tool
49 Requires:               %name = %version-%release
50 Group:                  Applications/Internet
51 Requires:               httpd
52 # This conflict field is required because Lighttpd and Apache
53 # cannot listen on the same port at the same time. Even using diffeernt
54 # ports cause problems like shared framework cache and
55 # web server specific directories permissions (for lighttpd and apache
56 # users).
57 Conflicts:              %{name}-lighttpd
58
59 %description httpd
60 This package provides the Apache configuration for Baculum WebGUI tool.
61 By using this module it is possible to run Baculum in Apache environment.
62
63 %package lighttpd
64 Summary:                Lighttpd configuration for Baculum WebGUI tool
65 Requires:               %name = %version-%release
66 Group:                  Applications/Internet
67 Requires:               lighttpd
68 Requires:               lighttpd-fastcgi
69 # This conflict field is required because Lighttpd and Apache
70 # cannot listen on the same port at the same time. Even using diffeernt
71 # ports cause problems like shared framework cache and
72 # web server specific directories permissions (for lighttpd and apache
73 # users).
74 Conflicts:              %{name}-httpd
75
76 %description lighttpd
77 This package provides the Lighttpd configuration for Baculum WebGUI tool.
78 By using this module it is possible to run Baculum in Lighttpd environment.
79
80 %prep
81 %setup -n bacula-gui-%version/baculum
82
83 %build
84 # Execute files preparation in build directory by Makefile
85 make build DESTDIR=%{destdir}
86 # Compilation SELinuxu policies before loading them
87 make -C examples/selinux/ -f %{_datadir}/selinux/devel/Makefile %{name}.pp
88 # Remove these cache directories, because here will be symbolic links
89 rmdir %{destdir}/%{_datadir}/%{name}/htdocs/assets
90 rmdir %{destdir}/%{_datadir}/%{name}/htdocs/protected/runtime
91 for lang in  %{langs}; do
92         rm %{destdir}/%{_datadir}/%{name}/htdocs/protected/Lang/${lang}/messages.mo
93 done
94
95 %install
96 cp -ra build/. %{buildroot}
97 %find_lang %{name} --all-name
98 install -m 644 examples/selinux/%{name}.pp %{buildroot}%{_datadir}/selinux/packages/%{name}/
99
100 %post
101 # these symbolic links indicates to Baculum's cache directory
102 ln -s  %{_localstatedir}/cache/%{name} %{_datadir}/%{name}/htdocs/assets
103 ln -s  %{_localstatedir}/cache/%{name} %{_datadir}/%{name}/htdocs/protected/runtime
104 # because framework does not use system locale dir, here are linked
105 # locale files to framework location
106 for lang in  %{langs}; do
107         ln -s  %{_datadir}/locale/${lang}/LC_MESSAGES/%{name}.mo \
108                 %{_datadir}/%{name}/htdocs/protected/Lang/${lang}/messages.mo
109 done
110
111 %post selinux
112 if [ $1 -le 1 ] ; then
113         # Write access is possible for web servers user only to two directories
114         # -  Data/ directory stores settings and web server HTTP Basic credentials
115         # - /var/cache/baculum - cache used by framework in specific locations (assets/ and protected/runtime/)
116         #   by symbolic links to cache directory
117         semanage fcontext -a -t httpd_sys_rw_content_t '%{_datadir}/%{name}/htdocs/protected/Data(/.*)?' 2>/dev/null || :
118         restorecon -i -R '%{_datadir}/%{name}/htdocs/protected/Data' || :
119         semanage fcontext -a -t httpd_cache_t '%{_localstatedir}/cache/%{name}(/.*)?' 2>/dev/null || :
120         restorecon -i -R %{_localstatedir}/cache/%{name} || :
121         semodule -i %{_datadir}/selinux/packages/%{name}/%{name}.pp 2>/dev/null || :
122 fi
123
124 %post httpd
125 %systemd_post httpd.service
126 ln -s  %{_sysconfdir}/%{name}/Data-apache %{_datadir}/%{name}/htdocs/protected/Data
127
128 %post lighttpd
129 %systemd_post baculum-lighttpd.service
130 ln -s  %{_sysconfdir}/%{name}/Data-lighttpd %{_datadir}/%{name}/htdocs/protected/Data
131
132 %preun
133 for lang in  %{langs}; do
134         rm %{_datadir}/%{name}/htdocs/protected/Lang/${lang}/messages.mo
135 done
136 rm %{_datadir}/%{name}/htdocs/assets
137 rm %{_datadir}/%{name}/htdocs/protected/runtime
138
139
140 %preun httpd
141 %systemd_preun httpd.service
142 if [ $1 -lt 1 ] ; then
143         # Rename settings if exist.
144         # Note, 'config' macro cannot be used because this file is created after successful
145         # installation via wizard. Also using 'config' macro to /usr location strictly forbidden
146         # by Packaging Guidelines.
147         [ ! -e %{_datadir}/%{name}/htdocs/protected/Data/settings.conf ] ||
148                 mv %{_datadir}/%{name}/htdocs/protected/Data/settings.conf \
149                 %{_datadir}/%{name}/htdocs/protected/Data/settings.conf.apache
150         # remove debug files if any
151         [ ! -e %{_datadir}/%{name}/htdocs/protected/Data/baculum.dbg ] ||
152                 rm %{_datadir}/%{name}/htdocs/protected/Data/baculum*.dbg
153         rm %{_datadir}/%{name}/htdocs/protected/Data
154
155 fi
156
157 %preun lighttpd
158 %systemd_preun baculum-lighttpd.service
159 if [ $1 -lt 1 ] ; then
160         # Rename settings if exist.
161         # Note, 'config' macro cannot be used because this file is created after successful
162         # installation via wizard. Also using 'config' macro to /usr location strictly forbidden
163         # by Packaging Guidelines.
164         [ ! -e %{_datadir}/%{name}/htdocs/protected/Data/settings.conf ] ||
165                 mv %{_datadir}/%{name}/htdocs/protected/Data/settings.conf \
166                 %{_datadir}/%{name}/htdocs/protected/Data/settings.conf.lighttpd
167         # remove debug files if any
168         [ ! -e %{_datadir}/%{name}/htdocs/protected/Data/baculum.dbg ] ||
169                 rm %{_datadir}/%{name}/htdocs/protected/Data/baculum*.dbg
170         rm %{_datadir}/%{name}/htdocs/protected/Data
171 fi
172
173 %postun selinux
174 if [ $1 -eq 0 ] ; then
175         semanage fcontext -d -t httpd_sys_rw_content_t '%{_datadir}/%{name}/htdocs/protected/Data(/.*)?' 2>/dev/null || :
176         semanage fcontext -d -t httpd_cache_t '%{_localstatedir}/cache/%{name}(/.*)?' 2>/dev/null || :
177         semodule -r %{name} 2>/dev/null || :
178 fi
179
180 %postun httpd
181 %systemd_postun_with_restart httpd.service
182
183 %postun lighttpd
184 %systemd_postun_with_restart baculum-lighttpd.service
185
186 %files -f %{name}.lang
187 %defattr(-,root,root)
188 # directory excluded here, because it needs to be provided
189 # with selected web server privileges (lighttpd or apache)
190 %exclude %{_datadir}/%{name}/htdocs/protected/Data
191 %{_datadir}/%{name}
192 %license LICENSE
193 %doc AUTHORS README
194
195 %files selinux
196 %defattr(-,root,root)
197 %{_datadir}/selinux/packages/%{name}/%{name}.pp
198
199 %files httpd
200 %defattr(644,root,root)
201 # Apache logs are stored in /var/log/httpd/
202 %config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf
203 %attr(755,apache,apache) %{_localstatedir}/cache/%{name}/
204 %attr(700,apache,apache) %{_sysconfdir}/%{name}/Data-apache/
205 %attr(600,apache,apache) %{_sysconfdir}/%{name}/Data-apache/%{name}.users
206
207 %files lighttpd
208 %defattr(644,root,root)
209 # Lighttpd logs are stored in /var/log/lighttpd
210 %attr(755,lighttpd,lighttpd) %{_localstatedir}/cache/%{name}/
211 %attr(700,lighttpd,lighttpd) %{_sysconfdir}/%{name}/Data-lighttpd
212 %attr(600,lighttpd,lighttpd) %{_sysconfdir}/%{name}/Data-lighttpd/%{name}.users
213 %{_unitdir}/%{name}-lighttpd.service
214 %config(noreplace) %{_sysconfdir}/%{name}/%{name}-lighttpd.conf
215
216 %changelog
217  * Tue Dec 15 2015 Marcin Haba <marcin.haba@bacula.pl> - 7.2.0
218  - Add creating and removing Data/ directory symbolic link
219  - Match locations to bacula-gui directories structure
220  * Sat Jul 18 2015 Marcin Haba <marcin.haba@bacula.pl> - 7.0.6-0.5.b
221  - Change baculum.users and Data/ directory permissions to more
222    restrictive
223  - Add noreplace param to Lighttpd config file
224  - Add systemd macros for httpd subpackage
225  - Fix systemd action in post section
226  - Move DESTDIR target and languages to global variables
227  - Do not remove settings file when a web server specific package
228    is removed (used move action)
229  - Drop storing Lighttpd logs in separate logs directory
230  - Define locale files
231  * Fri Jul 17 2015 Marcin Haba <marcin.haba@bacula.pl> - 7.0.6-0.4.b
232  - Remove source files: baculum.users, baculum-apache.conf
233    baculum-lighttpd.conf and baculum-lighttpd.service
234  - Use reorganized upstream Makefile
235  * Tue Jul 14 2015 Marcin Haba <marcin.haba@bacula.pl> - 7.0.6-0.3.b
236  - Separate to subpackage Lighttpd support
237  - Add Apache subpackage
238  - Use upstream Makefile to prepare build files
239  - Cache symlbolic links only in install section
240  - Add comments to Spec
241  - Compile SELinux policies instead of install pre-compiled
242  - Add source files: baculum.users, baculum-apache.conf
243    baculum-lighttpd.conf and baculum-lighttpd.service
244  - Change Source0 URL
245  * Mon Jul 13 2015 Marcin Haba <marcin.haba@bacula.pl> - 7.0.6-0.2.b
246  - Remove chkconfig and service dependencies from Spec
247  - Change Spec sections order
248  - Correct package description typos and errors
249  * Mon Jul 06 2015 Marcin Haba <marcin.haba@bacula.pl> - 7.0.6-0.1.b
250  - Spec create