1 |
%global __requires_exclude pear\\(vendor/autoload.php\\)|pear\\(xmlapi.php\\)|pear\\(Console/CommandLine.php\\) |
2 |
## pear(xmlapi.php) may need to be packaged, but for the time being a bug has been filed |
3 |
%define oname %{name}-%{version} |
4 |
|
5 |
%global php_inidir %{_sysconfdir}/php.d |
6 |
|
7 |
# Paths. Do not include trailing slash |
8 |
%global roundcube %{_datadir}/roundcubemail |
9 |
%global roundcube_plugins %{roundcube}/plugins |
10 |
%global roundcube_conf %{_sysconfdir}/roundcubemail |
11 |
%global roundcube_log %{_logdir}/roundcubemail |
12 |
%global roundcube_lib %{_localstatedir}/lib/roundcubemail |
13 |
|
14 |
Name: roundcubemail |
15 |
Version: 1.0.6 |
16 |
%define subrel 1 |
17 |
Release: %mkrel 1 |
18 |
Summary: Round Cube Webmail is a browser-based multilingual IMAP client |
19 |
Group: System/Servers |
20 |
License: GPLv3 |
21 |
# Use the -dep tarballs. These use system copies of the PHP stuff |
22 |
# rather than including them, which is better for our purposes. |
23 |
# - AdamW 2007/07 |
24 |
URL: http://www.roundcube.net/ |
25 |
Source0: http://downloads.sourceforge.net/%{name}/%{oname}.tar.gz |
26 |
Source1: roundcubemail.conf |
27 |
Source2: roundcubemail.logrotate |
28 |
Source3: roundcubemail-README.mageia |
29 |
# Elegantly handle removal of moxieplayer Flash binary in tinymce |
30 |
# media plugin (see "Drop precompiled flash" in %%prep) |
31 |
Patch0: roundcubemail-0.9.3-no_swf.patch |
32 |
Epoch: 1 |
33 |
Requires: apache-mod_php |
34 |
Requires: php-gd |
35 |
Requires: php-gettext |
36 |
Requires: php-iconv |
37 |
Requires: php-mbstring |
38 |
Requires: php-mcrypt |
39 |
Requires: php-openssl |
40 |
Requires: php-session |
41 |
Requires: php-pdo_mysql |
42 |
Requires: php-pear-Auth_SASL |
43 |
Requires: php-pear-Mail_Mime |
44 |
Requires: php-pear-Mail_mimeDecode |
45 |
Requires: php-pear-Net_SMTP |
46 |
Requires: php-pear-Net_LDAP2 |
47 |
Requires: php-pear-Net_Sieve |
48 |
Requires: php-pear-Net_Socket |
49 |
Requires: php-pear-MDB2 |
50 |
Requires: php-pear-Net_IDNA2 |
51 |
Requires(pre): php-pear >= 1.9.0 |
52 |
Requires: php-xml |
53 |
Requires: iRony |
54 |
Requires: php-pear-Crypt_GPG |
55 |
# The installer suggests the use of these, but they're not |
56 |
# required - AdamW 2011/01 |
57 |
Recommends: php-fileinfo |
58 |
Recommends: php-intl |
59 |
Recommends: php-pear-MDB2_Driver_mysql |
60 |
Recommends: php-zip |
61 |
BuildArch: noarch |
62 |
|
63 |
%description |
64 |
RoundCube Webmail is a browser-based multilingual IMAP client with an |
65 |
application-like user interface. It provides full functionality you |
66 |
expect from an e-mail client, including MIME support, address book, |
67 |
folder manipulation, message searching and spell checking. |
68 |
RoundCube Webmail is written in PHP and requires a database: MariaDB, |
69 |
PostgreSQL and SQLite are known to work. |
70 |
The user interface is fully skinnable using XHTML and CSS 2. |
71 |
|
72 |
%prep |
73 |
%setup -q -n %{oname} |
74 |
%patch0 -p1 |
75 |
|
76 |
# remove any reference to sqlite in config file so people don't mistakely |
77 |
# assume it works |
78 |
sed -i '/sqlite/d' config/defaults.inc.php |
79 |
sed -i 's/\r//' SQL/mssql.initial.sql |
80 |
|
81 |
# Drop precompiled flash |
82 |
find . -type f -name '*.swf' | xargs rm -f |
83 |
|
84 |
# Wipe bbcode plugin from bundled TinyMCE to make doubleplus sure we cannot |
85 |
# be vulnerable to CVE-2012-4230, unaddressed upstream |
86 |
echo "CVE-2012-4230: removing tinymce bbcode plugin, check path if this fails." |
87 |
test -d program/js/*mce/plugins/bbcode && rm -rf program/js/*mce/plugins/bbcode || exit 1 |
88 |
|
89 |
|
90 |
%build |
91 |
|
92 |
%install |
93 |
install -d %{buildroot}%{roundcube} |
94 |
cp -pr ./* %{buildroot}%{roundcube} |
95 |
cp -a ./.htaccess %{buildroot}%{roundcube}/.htaccess |
96 |
# Remove settings from .htaccess we don't want |
97 |
sed -i \ |
98 |
-e '/memory_limit/d' \ |
99 |
-e '/post_max_size/d' \ |
100 |
-e '/upload_max_filesize/d' \ |
101 |
%{buildroot}%{roundcube}/.htaccess |
102 |
|
103 |
rm -rf %{buildroot}%{roundcube}/installer |
104 |
|
105 |
mkdir -p %{buildroot}%{_webappconfdir} |
106 |
cp -pr %SOURCE1 %{buildroot}%{_webappconfdir} |
107 |
|
108 |
|
109 |
mkdir -p %{buildroot}%{roundcube_conf} |
110 |
mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d |
111 |
cp -pr %SOURCE2 %{buildroot}%{_sysconfdir}/logrotate.d/roundcubemail |
112 |
|
113 |
mkdir -p %{buildroot}%{roundcube_lib}/plugins/enigma |
114 |
mkdir -p %{buildroot}%{roundcube_log} |
115 |
|
116 |
# use dist files as config files |
117 |
mv %{buildroot}%{roundcube}/config/config.inc.php.sample %{buildroot}%{roundcube_conf}/config.inc.php |
118 |
mv %{buildroot}%{roundcube}/config/defaults.inc.php %{buildroot}%{roundcube_conf}/defaults.inc.php |
119 |
# keep any other config files too |
120 |
mv %{buildroot}%{roundcube}/config/* %{buildroot}%{roundcube_conf}/ |
121 |
rm -rf %{buildroot}%{roundcube}/config |
122 |
rm -rf %{buildroot}%{roundcube}/logs |
123 |
rm -rf %{buildroot}%{roundcube}/temp |
124 |
|
125 |
pushd %{buildroot}%{roundcube} |
126 |
ln -s ../../..%{roundcube_conf} config |
127 |
ln -s ../../..%{roundcube_log} logs |
128 |
ln -s ../../..%{roundcube_lib} temp |
129 |
popd |
130 |
|
131 |
# Enigma |
132 |
mv %{buildroot}%{roundcube_plugins}/enigma/config.inc.php.dist %{buildroot}%{roundcube_conf}/enigma.inc.php |
133 |
rm -rf %{buildroot}%{roundcube_plugins}/enigma/config.inc.php |
134 |
pushd %{buildroot}%{roundcube_plugins}/enigma |
135 |
ln -s ../../../../..%{roundcube_conf}/enigma.inc.php config.inc.php |
136 |
rm -rf home/ |
137 |
ln -s ../../../../..%{roundcube_lib}/plugins/enigma/ home |
138 |
popd |
139 |
mkdir -p %{buildroot}%{roundcube_lib}/plugins/enigma |
140 |
|
141 |
# ACL plugin |
142 |
mv %{buildroot}%{roundcube_plugins}/acl/config.inc.php.dist %{buildroot}%{roundcube_conf}/acl.inc.php |
143 |
rm -rf %{buildroot}%{roundcube_plugins}/acl/config.inc.php |
144 |
pushd %{buildroot}%{roundcube_plugins}/acl/ |
145 |
ln -s ../../../../..%{roundcube_conf}/acl.inc.php config.inc.php |
146 |
popd |
147 |
|
148 |
# Managesieve plugin |
149 |
mv %{buildroot}%{roundcube_plugins}/managesieve/config.inc.php.dist %{buildroot}%{roundcube_conf}/managesieve.inc.php |
150 |
pushd %{buildroot}%{roundcube_plugins}/managesieve/ |
151 |
ln -s ../../../../..%{roundcube_conf}/managesieve.inc.php config.inc.php |
152 |
popd |
153 |
|
154 |
# Password plugin |
155 |
mv %{buildroot}%{roundcube_plugins}/password/config.inc.php.dist %{buildroot}%{roundcube_conf}/password.inc.php |
156 |
pushd %{buildroot}%{roundcube_plugins}/password/ |
157 |
ln -s ../../../../..%{roundcube_conf}/password.inc.php config.inc.php |
158 |
popd |
159 |
|
160 |
# clean up the buildroot |
161 |
rm -rf %{buildroot}%{roundcube}/{CHANGELOG,INSTALL,LICENSE,README,UPGRADING,SQL} |
162 |
|
163 |
# Fix anything executable that does not have a shebang |
164 |
for file in `find %{buildroot}/%{roundcube} -type f -perm /a+x`; do |
165 |
[ -z "`head -n 1 $file | grep \"^#!/\"`" ] && chmod -v 644 $file |
166 |
done |
167 |
|
168 |
# Find files with a shebang that do not have executable permissions |
169 |
for file in `find %{buildroot}/%{roundcube} -type f ! -perm /a+x`; do |
170 |
[ ! -z "`head -n 1 $file | grep \"^#!/\"`" ] && chmod -v 755 $file |
171 |
done |
172 |
|
173 |
# Find files that have non-standard-executable-perm |
174 |
find %{buildroot}/%{roundcube} -type f -perm /g+wx -exec chmod -v g-w {} \; |
175 |
|
176 |
# Find files that are not readable |
177 |
find %{buildroot}/%{roundcube} -type f ! -perm /go+r -exec chmod -v go+r {} \; |
178 |
|
179 |
# |
180 |
# Exclude the following external libraries |
181 |
# |
182 |
# php-pear-Net-IDNA2 |
183 |
rm -rf %{buildroot}/%{roundcube}/program/lib/Net/IDNA2/ \ |
184 |
%{buildroot}/%{roundcube}/program/lib/Net/IDNA2.php |
185 |
# php-pear-Net-SMTP |
186 |
rm -rf %{buildroot}/%{roundcube}/program/lib/Net/SMTP.php |
187 |
# php-pear-Net-Socket |
188 |
rm -rf %{buildroot}/%{roundcube}/program/lib/Net/Socket.php |
189 |
# php-pear-Mail |
190 |
rm -rf %{buildroot}/%{roundcube}/program/lib/Mail/ |
191 |
# php-pear-MDB2 |
192 |
rm -rf %{buildroot}/%{roundcube}/program/lib/MDB2/ \ |
193 |
%{buildroot}/%{roundcube}/program/lib/MDB2.php |
194 |
# php-pear |
195 |
rm -rf %{buildroot}/%{roundcube}/program/lib/PEAR.php \ |
196 |
%{buildroot}/%{roundcube}/program/lib/PEAR5.php |
197 |
# php-pear-Net-Sieve |
198 |
rm -rf %{buildroot}/%{roundcube_plugins}/managesieve/lib/Net |
199 |
|
200 |
|
201 |
%pre |
202 |
# needed if you have kolab installed |
203 |
if [ -f "/etc/roundcubemail/kolab.inc.php" ]; then |
204 |
mv /etc/roundcubemail/kolab.inc.php /etc/roundcubemail/libkolab.inc.php |
205 |
fi |
206 |
|
207 |
if [ -L %{roundcube_plugins}/enigma/home -a ! -d %{roundcube_plugins}/enigma/home ]; then |
208 |
rm -rf %{roundcube_plugins}/enigma/home >/dev/null 2>&1 || : |
209 |
fi |
210 |
|
211 |
|
212 |
|
213 |
%post |
214 |
# replace default des string in config file for better security |
215 |
function makedesstr () { |
216 |
chars=(0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z A |
217 |
B C D E F G H I J K L M N O P Q R S T U V W X Y Z) |
218 |
|
219 |
max=${#chars[*]} |
220 |
|
221 |
for i in `seq 1 24`; do |
222 |
let rand=${RANDOM}%%${max} |
223 |
str="${str}${chars[$rand]}" |
224 |
done |
225 |
echo $str |
226 |
} |
227 |
|
228 |
sed -i "s/rcmail-\!24ByteDESkey\*Str/`makedesstr`/" /etc/roundcubemail/defaults.inc.php || : &> /dev/null |
229 |
|
230 |
sed -i -r -e "s/.*(\s*define\(\s*'RCMAIL_VERSION'\s*,\s*').*('\);)/\1%{version}-%{release}\2/g" \ |
231 |
%{roundcube}/program/include/iniset.php || : |
232 |
|
233 |
if [ -f "%{php_inidir}/99_apcu.ini" ]; then |
234 |
if [ ! -z "`grep ^apcu.enabled=1 %{php_inidir}/99_apc.ini`" ]; then |
235 |
|
236 |
/sbin/systemctl condrestart %{httpd_name} |
237 |
|
238 |
fi |
239 |
fi |
240 |
|
241 |
/usr/share/roundcubemail/bin/updatedb.sh \ |
242 |
--dir /usr/share/doc/roundcubemail/SQL/ \ |
243 |
--package roundcube || : \ |
244 |
>/dev/null 2>&1 |
245 |
|
246 |
exit 0 |
247 |
|
248 |
cat > README.urpmi <<EOF |
249 |
WARNING: when upgrading from <= 0.9.5 the old configuration files named |
250 |
main.inc.php and db.inc.php are now deprecated and should be replaced |
251 |
with one single config.inc.php file. Run the ./bin/update.sh script to |
252 |
get this conversion done or manually merge the files. |
253 |
Also see the UPGRADE file in the doc section. |
254 |
NOTE: the new config.inc.php should only contain options that differ |
255 |
from the ones listed in defaults.inc.php. |
256 |
EOF |
257 |
|
258 |
%files |
259 |
%doc CHANGELOG INSTALL LICENSE README.md SQL UPGRADING |
260 |
%{_datadir}/%{name} |
261 |
%dir %{_sysconfdir}/%{name} |
262 |
%attr(0755,root,apache)%{_logdir}/%{name} |
263 |
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} |
264 |
# Lets write out them specifically, so we can see when additional files are added (or deleted) |
265 |
%attr(0640,root,apache)%config(noreplace) %{_sysconfdir}/%{name}/acl.inc.php |
266 |
%attr(0640,root,apache)%config(noreplace) %{_sysconfdir}/%{name}/defaults.inc.php |
267 |
%attr(0640,root,apache)%config(noreplace) %{_sysconfdir}/%{name}/config.inc.php |
268 |
%attr(0640,root,apache)%config(noreplace) %{_sysconfdir}/%{name}/enigma.inc.php |
269 |
%attr(0640,root,apache)%config(noreplace) %{_sysconfdir}/%{name}/managesieve.inc.php |
270 |
%attr(0640,root,apache)%config(noreplace) %{_sysconfdir}/%{name}/mimetypes.php |
271 |
%attr(0640,root,apache)%config(noreplace) %{_sysconfdir}/%{name}/password.inc.php |
272 |
%config(noreplace) %{_webappconfdir}/%{name}.conf |
273 |
%attr(0775,root,apache) %dir %{_localstatedir}/lib/roundcubemail |
274 |
%attr(0770,root,apache) %dir %{_localstatedir}/lib/roundcubemail/plugins |
275 |
%attr(0770,root,apache) %dir %{_localstatedir}/lib/roundcubemail/plugins/enigma |
276 |
|