]>
Commit | Line | Data |
---|---|---|
1 | # TODO: | |
2 | # - use system js/tiny_mce | |
3 | # - use system js/jquery | |
4 | # - package: http://blog.ilohamail.org/ and remove boundled classess from it | |
5 | # - test/finish and then enable by default password-anon-ldap-bind patch | |
6 | # - bconds does not work for a long time | |
7 | # | |
8 | %bcond_with spamfilter # Build with spamfilter patch | |
9 | %bcond_with postfixadmin # Build with postfixadmin support patch | |
10 | %bcond_with password_anon_ldap_bind # apply with password-anon-ldap-bind patch. | |
11 | ||
12 | %define rcpfa_ver 1.0.5 | |
13 | %define php_min_version 5.2.3 | |
14 | %include /usr/lib/rpm/macros.php | |
15 | Summary: RoundCube Webmail | |
16 | Summary(pl.UTF-8): RoundCube Webmail - poczta przez WWW | |
17 | Name: roundcubemail | |
18 | Version: 0.9.4 | |
19 | Release: 1 | |
20 | License: GPL v3+ | |
21 | Group: Applications/Mail | |
22 | Source0: http://downloads.sourceforge.net/roundcubemail/%{name}-%{version}-dep.tar.gz | |
23 | # Source0-md5: 8ec32e093983128ef1a87c561bb48c99 | |
24 | Source1: apache.conf | |
25 | Source2: %{name}.logrotate | |
26 | Source3: lighttpd.conf | |
27 | Source4: http://nejc.skoberne.net/wp-content/uploads/2008/11/rcpfa-105.tgz | |
28 | # Source4-md5: dc23bcd894f693db74fce53b09ab58d6 | |
29 | Source5: find-lang.sh | |
30 | Source6: httpd.conf | |
31 | Patch0: %{name}-config.patch | |
32 | Patch1: %{name}-spam.patch | |
33 | Patch2: %{name}-postfixadmin-pl_locales.patch | |
34 | Patch3: %{name}-faq-page.patch | |
35 | Patch4: %{name}-password-anon-ldap-bind.patch | |
36 | URL: http://www.roundcube.net/ | |
37 | BuildRequires: rpm-php-pearprov >= 4.4.2-11 | |
38 | BuildRequires: rpm-pythonprov | |
39 | BuildRequires: rpmbuild(macros) >= 1.566 | |
40 | BuildRequires: sed >= 4.0 | |
41 | Requires: %{name}-skin | |
42 | Requires: php(core) >= %{php_min_version} | |
43 | Requires: php(date) | |
44 | Requires: php(dom) | |
45 | Requires: php(iconv) | |
46 | Requires: php(imap) | |
47 | Requires: php(pcre) | |
48 | Requires: php(session) | |
49 | Requires: php(simplexml) | |
50 | Requires: php(sockets) | |
51 | Requires: php(spl) | |
52 | Requires: php(xml) | |
53 | Requires: php-pear-DB | |
54 | Requires: php-pear-Mail_Mime >= 1.8.0 | |
55 | Requires: php-pear-Net_IDNA2 >= 0.1.1 | |
56 | Requires: php-pear-Net_SMTP | |
57 | Requires: rpm-whiteout >= 1.22 | |
58 | Requires: webapps | |
59 | Requires: webserver(alias) | |
60 | Requires: webserver(indexfile) | |
61 | Requires: webserver(php) | |
62 | Requires(post): openssl-tools | |
63 | Suggests: php(exif) | |
64 | Suggests: php(fileinfo) | |
65 | Suggests: php-gd | |
66 | Suggests: php-intl | |
67 | Suggests: php-json | |
68 | Suggests: php-mbstring | |
69 | Suggests: php-mcrypt | |
70 | Suggests: php-openssl | |
71 | Suggests: php-pear-Auth_SASL | |
72 | # at least one MDB2 db driver needed | |
73 | Suggests: php-pear-MDB2_Driver_mysql | |
74 | Suggests: php-pear-MDB2_Driver_pgsql | |
75 | Suggests: php-pear-MDB2_Driver_sqlite | |
76 | Suggests: php-pear-Net_LDAP2 | |
77 | Suggests: php-pear-Net_Sieve | |
78 | Suggests: php-pear-Net_Socket | |
79 | Suggests: php-xml | |
80 | Obsoletes: roundcube-plugin-jqueryui | |
81 | Obsoletes: roundcubemail-skin-default | |
82 | Conflicts: apache-base < 2.4.0-1 | |
83 | Conflicts: logrotate < 3.8.0 | |
84 | BuildArch: noarch | |
85 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
86 | ||
87 | %define _webapps /etc/webapps | |
88 | %define _webapp roundcube | |
89 | %define _sysconfdir %{_webapps}/%{_webapp} | |
90 | %define _appdir %{_datadir}/%{_webapp} | |
91 | %define _appdatadir /var/lib/roundcube | |
92 | %define _applogdir /var/log/roundcube | |
93 | %define _archivelogdir /var/log/archive/roundcube | |
94 | ||
95 | %define find_lang sh %{SOURCE5} %{buildroot} | |
96 | ||
97 | # bad depsolver | |
98 | %define _noautopear pear | |
99 | ||
100 | # exclude optional php dependencies | |
101 | %define _noautophp php-sqlite php-mysql php-mysqli php-pgsql php-hash php-json php-xml | |
102 | ||
103 | # put it together for rpmbuild | |
104 | %define _noautoreq %{?_noautophp} %{?_noautopear} | |
105 | ||
106 | %description | |
107 | RoundCube Webmail is a browser-based multilingual IMAP client with an | |
108 | application-like user interface. It provides full functionality you | |
109 | expect from an e-mail client, including MIME support, address book, | |
110 | folder manipulation and message filters. RoundCube Webmail is written | |
111 | in PHP and requires the MySQL database. The user interface is fully | |
112 | skinnable using XHTML and CSS 2. | |
113 | ||
114 | %description -l pl.UTF-8 | |
115 | RoundCube Webmail to oparty na przeglądarce wielojęzyczny klient PHP z | |
116 | interfejsem użytkownika podobnym do aplikacji. Udostępnia pełną | |
117 | funkcjonalność jakiej można oczekiwać od klienta pocztowego, w tym | |
118 | obsługę MIME, książkę adresową, operacje na folderach i filtry | |
119 | wiadomości. RoundCube Webmail jest napisany w PHP i wymaga bazy danych | |
120 | MySQL. Interfejs użytkownika można w pełni obudować skórką przy użyciu | |
121 | XHTML-a i CSS 2. | |
122 | ||
123 | %package setup | |
124 | Summary: Installer script for RoundCube Webmail | |
125 | Summary(pl.UTF-8): Skrypt instalacyjny RoundCube Webmaila | |
126 | Group: Applications/WWW | |
127 | Requires: %{name} = %{version}-%{release} | |
128 | ||
129 | %description setup | |
130 | This package provides installer script for RoundCube Webmail. | |
131 | ||
132 | %description setup -l pl.UTF-8 | |
133 | Ten pakiet zawiera skrypt instalacyjny RoundCube Webmaila. | |
134 | ||
135 | %package skin-classic | |
136 | Summary: Classic skin for RoundCube Webmail | |
137 | Summary(pl.UTF-8): Klasyczna skórka dla RoundCube Webmaila | |
138 | Group: Applications/WWW | |
139 | Requires: %{name} = %{version}-%{release} | |
140 | Provides: %{name}-skin | |
141 | ||
142 | %description skin-classic | |
143 | Classic skin for RoundCube Webmail. | |
144 | ||
145 | %description skin-classic -l pl.UTF-8 | |
146 | Klasyczna skórka dla RoundCube Webmaila. | |
147 | ||
148 | %package skin-larry | |
149 | Summary: Larry skin for RoundCube Webmail | |
150 | Summary(pl.UTF-8): Skórka Larry dla RoundCube Webmaila | |
151 | Group: Applications/WWW | |
152 | Requires: %{name} = %{version}-%{release} | |
153 | Provides: %{name}-skin | |
154 | ||
155 | %description skin-larry | |
156 | Larry skin for RoundCube Webmail. | |
157 | ||
158 | %description skin-larry -l pl.UTF-8 | |
159 | Skórka Larry dla RoundCube Webmaila. | |
160 | ||
161 | %prep | |
162 | %setup -q -n %{name}-%{version}-dep %{?with_postfixadmin:-a 4} | |
163 | %patch0 -p1 | |
164 | %if %{with spamfilter} | |
165 | %patch1 -p1 | |
166 | %endif | |
167 | %if %{with postfixadmin} | |
168 | #patch2 -p1 | |
169 | %endif | |
170 | #%patch3 -p1 | |
171 | %if %{with password_anon_ldap_bind} | |
172 | %patch4 -p1 | |
173 | %endif | |
174 | ||
175 | find -name .svn | xargs -r rm -rf | |
176 | ||
177 | # undos the source | |
178 | %undos -f php,inc,js,css | |
179 | ||
180 | # kill extensions and fill proper shebang | |
181 | %{__sed} -i -e '1s,^#!.*php,#!%{__php},' bin/*.sh | |
182 | for a in bin/*.sh; do | |
183 | mv $a ${a%.sh} | |
184 | done | |
185 | ||
186 | %{__sed} -i s/indexcontacts.sh/indexcontacts/g bin/update | |
187 | %{__sed} -i s/updatedb.sh/update/g bin/update | |
188 | ||
189 | # tools to pack js | |
190 | rm bin/{jsshrink,jsunshrink} | |
191 | ||
192 | # php-pear-Net_Sieve 1.3.0 | |
193 | rm plugins/managesieve/lib/Net/Sieve.php | |
194 | ||
195 | # now empty dirs | |
196 | rmdir plugins/managesieve/lib/Net | |
197 | ||
198 | # pear package junk | |
199 | rm -v plugins/*/package.xml | |
200 | ||
201 | mv config/db.inc.php.dist config/db.inc.php | |
202 | mv config/main.inc.php.dist config/main.inc.php | |
203 | %if %{with postfixadmin} | |
204 | mv rcpfa-%{rcpfa_ver} rcpfa | |
205 | cd rcpfa | |
206 | cp -p code/forwarding.html ../skins/default/templates | |
207 | cp -p code/password.html ../skins/default/templates | |
208 | cp -p code/vacation.html ../skins/default/templates | |
209 | cp -p code/pfa_forwarding.inc ../program/steps/settings | |
210 | cp -p code/pfa_password.inc ../program/steps/settings | |
211 | cp -p code/pfa_vacation.inc ../program/steps/settings | |
212 | cp -p code/pfa.php ../program/include | |
213 | ||
214 | %{__patch} -d .. -p1 < diffs/app.js.diff | |
215 | %{__patch} -d .. -p1 < diffs/db.inc.php.diff | |
216 | %{__patch} -d .. -p1 < diffs/func.inc.diff | |
217 | %{__patch} -d .. -p1 < diffs/index.php.diff | |
218 | %{__patch} -d .. -p1 < diffs/labels.inc.diff | |
219 | %{__patch} -d .. -p1 < diffs/main.inc.diff | |
220 | %{__patch} -d .. -p1 < diffs/main.inc.php.diff | |
221 | %{__patch} -d .. -p1 < diffs/messages.inc.diff | |
222 | %{__patch} -d .. -p1 < diffs/rcube_user.php.diff | |
223 | %{__patch} -d .. -p1 < diffs/settingstabs.html.diff | |
224 | %endif | |
225 | ||
226 | # cleanup backups after patching | |
227 | find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f | |
228 | ||
229 | %install | |
230 | rm -rf $RPM_BUILD_ROOT | |
231 | install -d $RPM_BUILD_ROOT{%{_appdatadir},%{_applogdir},%{_archivelogdir},%{_sysconfdir}} \ | |
232 | $RPM_BUILD_ROOT{%{_appdir}/{bin,config,installer,program,skins},/etc/logrotate.d} | |
233 | ||
234 | # Main application part: | |
235 | cp -a program/* $RPM_BUILD_ROOT%{_appdir}/program | |
236 | cp -a bin/* $RPM_BUILD_ROOT%{_appdir}/bin | |
237 | cp -a index.php $RPM_BUILD_ROOT%{_appdir} | |
238 | ||
239 | # Skins installation | |
240 | cp -a skins/* $RPM_BUILD_ROOT%{_appdir}/skins | |
241 | ||
242 | # Installer part | |
243 | cp -a installer/* $RPM_BUILD_ROOT%{_appdir}/installer | |
244 | cp -a config/db.inc.php $RPM_BUILD_ROOT%{_appdir}/config/db.inc.php.dist | |
245 | cp -a config/main.inc.php $RPM_BUILD_ROOT%{_appdir}/config/main.inc.php.dist | |
246 | cp -a SQL $RPM_BUILD_ROOT%{_appdir} | |
247 | ||
248 | # Plugins | |
249 | cp -a plugins $RPM_BUILD_ROOT%{_appdir}/plugins | |
250 | ||
251 | ## Configuration: | |
252 | cp -a config/db.inc.php $RPM_BUILD_ROOT%{_sysconfdir}/db.inc.php | |
253 | cp -a config/main.inc.php $RPM_BUILD_ROOT%{_sysconfdir}/main.inc.php | |
254 | ln -sf %{_sysconfdir}/db.inc.php $RPM_BUILD_ROOT%{_appdir}/config/db.inc.php | |
255 | ln -sf %{_sysconfdir}/main.inc.php $RPM_BUILD_ROOT%{_appdir}/config/main.inc.php | |
256 | ||
257 | cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf | |
258 | cp -p %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf | |
259 | cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/lighttpd.conf | |
260 | cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/logrotate.d/%{name} | |
261 | ||
262 | # find locales | |
263 | %find_lang %{name}.lang | |
264 | # sed -ne 's/%lang(\([^)]\+\).*/\1/p' %{name}.lang | sort -u | grep _ | |
265 | ||
266 | # now package plugins using filelist as well, as due lang tagging the files | |
267 | # section will go unmanageable | |
268 | for p in $RPM_BUILD_ROOT%{_appdir}/plugins/*; do | |
269 | echo "%dir ${p#$RPM_BUILD_ROOT}" | |
270 | for p in $p/*; do | |
271 | d=${p##*/} | |
272 | p=${p#$RPM_BUILD_ROOT} | |
273 | case "$d" in | |
274 | localization) | |
275 | continue | |
276 | ;; | |
277 | README | Changelog | config.inc.php.dist) | |
278 | echo "%doc $p" | |
279 | ;; | |
280 | *) | |
281 | echo "$p" | |
282 | ;; | |
283 | esac | |
284 | done | |
285 | done > plugins.lang | |
286 | cat plugins.lang >> %{name}.lang | |
287 | ||
288 | %clean | |
289 | rm -rf $RPM_BUILD_ROOT | |
290 | ||
291 | %post | |
292 | # replace default des string in config file for better security | |
293 | makedesstr() { | |
294 | openssl rand -hex 12 | |
295 | } | |
296 | ||
297 | if grep -q '24ByteDESkey' %{_sysconfdir}/main.inc.php; then | |
298 | des=$(makedesstr) | |
299 | # precaution if random str generation failed | |
300 | if [ c$(echo -n "$des" | wc -c) = c24 ]; then | |
301 | %{__sed} -i -e "s/rcmail-\!24ByteDESkey\*Str/$des/" %{_sysconfdir}/main.inc.php | |
302 | fi | |
303 | fi | |
304 | ||
305 | %pretrans | |
306 | if [ ! -f %{_sysconfdir}/db.inc.php -o ! -f %{_sysconfdir}/main.inc.php ]; then | |
307 | # import configs from previously manually installed site | |
308 | d=/home/services/httpd/html/config | |
309 | if [ -f $d/db.inc.php -o -f $d/main.inc.php ]; then | |
310 | echo >&2 "Importing site configs from $d" | |
311 | mkdir -p %{_sysconfdir} | |
312 | if [ -f $d/db.inc.php ]; then | |
313 | [ -f %{_sysconfdir}/db.inc.php ] && mv -f %{_sysconfdir}/db.inc.php{,.rpmorig} | |
314 | cp -af $d/db.inc.php %{_sysconfdir}/db.inc.php | |
315 | fi | |
316 | if [ -f $d/main.inc.php ]; then | |
317 | [ -f %{_sysconfdir}/main.inc.php ] && mv -f %{_sysconfdir}/main.inc.php{,.rpmorig} | |
318 | cp -af $d/main.inc.php %{_sysconfdir}/main.inc.php | |
319 | fi | |
320 | fi | |
321 | fi | |
322 | ||
323 | # Note this on version upgrade | |
324 | %triggerpostun -- %{name} < %{version}-0 | |
325 | # don't do anything on --downgrade | |
326 | if [ $1 -le 1 ]; then | |
327 | exit 0 | |
328 | fi | |
329 | %banner -e %{name}-upgrade <<-EOF | |
330 | Run %{_appdir}/bin/update to update to version %{version}. | |
331 | (Be sure to have %{name}-setup installed when you run it) | |
332 | ||
333 | See %{_docdir}/%{name}-%{version}/UPGRADING* for more information. | |
334 | EOF | |
335 | ||
336 | %triggerin -- apache1 < 1.3.37-3, apache1-base | |
337 | %webapp_register apache %{_webapp} | |
338 | ||
339 | %triggerun -- apache1 < 1.3.37-3, apache1-base | |
340 | %webapp_unregister apache %{_webapp} | |
341 | ||
342 | %triggerin -- apache-base | |
343 | %webapp_register httpd %{_webapp} | |
344 | ||
345 | %triggerun -- apache-base | |
346 | %webapp_unregister httpd %{_webapp} | |
347 | ||
348 | %triggerin -- lighttpd | |
349 | %webapp_register lighttpd %{_webapp} | |
350 | ||
351 | %triggerun -- lighttpd | |
352 | %webapp_unregister lighttpd %{_webapp} | |
353 | ||
354 | %files -f %{name}.lang | |
355 | %defattr(644,root,root,755) | |
356 | %doc CHANGELOG INSTALL README.md UPGRADING | |
357 | %dir %attr(750,root,http) %{_sysconfdir} | |
358 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache.conf | |
359 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf | |
360 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lighttpd.conf | |
361 | %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*.php | |
362 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name} | |
363 | %dir %{_appdir} | |
364 | %{_appdir}/*.php | |
365 | %dir %{_appdir}/config | |
366 | %{_appdir}/config/*.php | |
367 | %dir %{_appdir}/program | |
368 | %{_appdir}/program/include | |
369 | %{_appdir}/program/js | |
370 | %{_appdir}/program/lib | |
371 | %{_appdir}/program/resources | |
372 | %{_appdir}/program/steps | |
373 | %{_appdir}/program/localization/index.inc | |
374 | ||
375 | %dir %{_appdir}/plugins | |
376 | ||
377 | %dir %{_appdir}/skins | |
378 | %dir %attr(770,root,http) %{_applogdir} | |
379 | %dir %attr(751,root,logs) %{_archivelogdir} | |
380 | %dir %attr(770,root,http) %{_appdatadir} | |
381 | ||
382 | # TODO: %ghost logfile(s) | |
383 | ||
384 | %files setup | |
385 | %defattr(644,root,root,755) | |
386 | %dir %{_appdir}/bin | |
387 | %attr(755,root,root) %{_appdir}/bin/* | |
388 | %dir %{_appdir}/installer | |
389 | %{_appdir}/installer/*.php | |
390 | %{_appdir}/installer/client.js | |
391 | %{_appdir}/installer/styles.css | |
392 | %{_appdir}/installer/images | |
393 | %{_appdir}/config/*.php.dist | |
394 | %{_appdir}/SQL | |
395 | ||
396 | %files skin-classic | |
397 | %defattr(644,root,root,755) | |
398 | %{_appdir}/skins/classic | |
399 | ||
400 | %files skin-larry | |
401 | %defattr(644,root,root,755) | |
402 | %{_appdir}/skins/larry |