1 |
%define _requires_exceptions pear(vendor/autoload.php) |
2 |
|
3 |
|
4 |
%define oname %{name}-%{version}-dep |
5 |
|
6 |
|
7 |
|
8 |
# Paths. Do not include trailing slash |
9 |
%global roundcube %{_datadir}/roundcubemail |
10 |
%global roundcube_plugins %{roundcube}/plugins |
11 |
%global roundcube_conf %{_sysconfdir}/roundcubemail |
12 |
%global roundcube_log %{_logdir}/roundcubemail |
13 |
%global roundcube_lib %{_localstatedir}/lib/roundcubemail |
14 |
|
15 |
Name: roundcubemail |
16 |
Version: 1.0.0 |
17 |
Release: %mkrel 0.3 |
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 |
Epoch: 1 |
30 |
Requires: apache-mod_php |
31 |
Requires: php-gd |
32 |
Requires: php-gettext |
33 |
Requires: php-iconv |
34 |
Requires: php-mbstring |
35 |
Requires: php-mcrypt |
36 |
Requires: php-openssl |
37 |
Requires: php-session |
38 |
Requires: php-pdo_mysql |
39 |
Requires: php-pear-Auth_SASL |
40 |
Requires: php-pear-Mail_Mime |
41 |
Requires: php-pear-Mail_mimeDecode |
42 |
Requires: php-pear-Net_SMTP |
43 |
Requires: php-pear-Net_LDAP2 |
44 |
Requires: php-pear-Net_Sieve |
45 |
Requires: php-pear-Net_Socket |
46 |
Requires: php-pear-MDB2 |
47 |
Requires: php-pear-Net_IDNA2 |
48 |
Requires(pre): php-pear >= 1.9.0 |
49 |
Requires: php-xml |
50 |
Requires: iRony |
51 |
Requires: php-pear-Crypt_PGP |
52 |
# The installer suggests the use of these, but they're not |
53 |
# required - AdamW 2011/01 |
54 |
Suggests: php-fileinfo |
55 |
Suggests: php-intl |
56 |
Suggests: php-pear-MDB2_Driver_mysql |
57 |
Suggests: php-zip |
58 |
BuildArch: noarch |
59 |
|
60 |
%description |
61 |
RoundCube Webmail is a browser-based multilingual IMAP client with an |
62 |
application-like user interface. It provides full functionality you |
63 |
expect from an e-mail client, including MIME support, address book, |
64 |
folder manipulation, message searching and spell checking. |
65 |
RoundCube Webmail is written in PHP and requires a database: MariaDB, |
66 |
PostgreSQL and SQLite are known to work. |
67 |
The user interface is fully skinnable using XHTML and CSS 2. |
68 |
|
69 |
%prep |
70 |
%setup -q -n %{oname} |
71 |
|
72 |
# remove any reference to sqlite in config file so people don't mistakely |
73 |
# assume it works |
74 |
sed -i '/sqlite/d' config/defaults.inc.php |
75 |
sed -i 's/\r//' SQL/mssql.initial.sql |
76 |
|
77 |
|
78 |
%build |
79 |
|
80 |
%install |
81 |
install -d %{buildroot}%{roundcube} |
82 |
cp -pr ./* %{buildroot}%{roundcube} |
83 |
cp -a ./.htaccess %{buildroot}%{roundcube}/.htaccess |
84 |
# Remove settings from .htaccess we don't want |
85 |
sed -i \ |
86 |
-e '/memory_limit/d' \ |
87 |
-e '/post_max_size/d' \ |
88 |
-e '/upload_max_filesize/d' \ |
89 |
%{buildroot}%{roundcube}/.htaccess |
90 |
|
91 |
rm -rf %{buildroot}%{roundcube}/installer |
92 |
|
93 |
mkdir -p %{buildroot}%{_webappconfdir} |
94 |
cp -pr %SOURCE1 %{buildroot}%{_webappconfdir} |
95 |
|
96 |
|
97 |
mkdir -p %{buildroot}%{roundcube_conf} |
98 |
mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d |
99 |
cp -pr %SOURCE2 %{buildroot}%{_sysconfdir}/logrotate.d/roundcubemail |
100 |
|
101 |
mkdir -p %{buildroot}%{roundcube_lib}/plugins/enigma |
102 |
mkdir -p %{buildroot}%{roundcube_log} |
103 |
|
104 |
# use dist files as config files |
105 |
mv %{buildroot}%{roundcube}/config/config.inc.php.sample %{buildroot}%{roundcube_conf}/config.inc.php |
106 |
mv %{buildroot}%{roundcube}/config/defaults.inc.php %{buildroot}%{roundcube_conf}/defaults.inc.php |
107 |
# keep any other config files too |
108 |
mv %{buildroot}%{roundcube}/config/* %{buildroot}%{roundcube_conf}/ |
109 |
rm -rf %{buildroot}%{roundcube}/config |
110 |
rm -rf %{buildroot}%{roundcube}/logs |
111 |
rm -rf %{buildroot}%{roundcube}/temp |
112 |
|
113 |
pushd %{buildroot}%{roundcube} |
114 |
ln -s ../../..%{roundcube_conf} config |
115 |
ln -s ../../..%{roundcube_log} logs |
116 |
ln -s ../../..%{roundcube_lib} temp |
117 |
popd |
118 |
|
119 |
# Enigma |
120 |
mv %{buildroot}%{roundcube_plugins}/enigma/config.inc.php.dist %{buildroot}%{roundcube_conf}/enigma.inc.php |
121 |
rm -rf %{buildroot}%{roundcube_plugins}/enigma/config.inc.php |
122 |
pushd %{buildroot}%{roundcube_plugins}/enigma |
123 |
ln -s ../../../../..%{roundcube_conf}/enigma.inc.php config.inc.php |
124 |
rm -rf home/ |
125 |
ln -s ../../../../..%{roundcube_lib}/plugins/enigma/ home |
126 |
popd |
127 |
mkdir -p %{buildroot}%{roundcube_lib}/plugins/enigma |
128 |
|
129 |
# ACL plugin |
130 |
mv %{buildroot}%{roundcube_plugins}/acl/config.inc.php.dist %{buildroot}%{roundcube_conf}/acl.inc.php |
131 |
rm -rf %{buildroot}%{roundcube_plugins}/acl/config.inc.php |
132 |
pushd %{buildroot}%{roundcube_plugins}/acl/ |
133 |
ln -s ../../../../..%{roundcube_conf}/acl.inc.php config.inc.php |
134 |
popd |
135 |
|
136 |
# Managesieve plugin |
137 |
mv %{buildroot}%{roundcube_plugins}/managesieve/config.inc.php.dist %{buildroot}%{roundcube_conf}/managesieve.inc.php |
138 |
pushd %{buildroot}%{roundcube_plugins}/managesieve/ |
139 |
ln -s ../../../../..%{roundcube_conf}/managesieve.inc.php config.inc.php |
140 |
popd |
141 |
|
142 |
# Password plugin |
143 |
mv %{buildroot}%{roundcube_plugins}/password/config.inc.php.dist %{buildroot}%{roundcube_conf}/password.inc.php |
144 |
pushd %{buildroot}%{roundcube_plugins}/password/ |
145 |
ln -s ../../../../..%{roundcube_conf}/password.inc.php config.inc.php |
146 |
popd |
147 |
|
148 |
# clean up the buildroot |
149 |
rm -rf %{buildroot}%{roundcube}/{CHANGELOG,INSTALL,LICENSE,README,UPGRADING,SQL} |
150 |
|
151 |
# Fix anything executable that does not have a shebang |
152 |
for file in `find %{buildroot}/%{roundcube} -type f -perm /a+x`; do |
153 |
[ -z "`head -n 1 $file | grep \"^#!/\"`" ] && chmod -v 644 $file |
154 |
done |
155 |
|
156 |
# Find files with a shebang that do not have executable permissions |
157 |
for file in `find %{buildroot}/%{roundcube} -type f ! -perm /a+x`; do |
158 |
[ ! -z "`head -n 1 $file | grep \"^#!/\"`" ] && chmod -v 755 $file |
159 |
done |
160 |
|
161 |
# Find files that have non-standard-executable-perm |
162 |
find %{buildroot}/%{roundcube} -type f -perm /g+wx -exec chmod -v g-w {} \; |
163 |
|
164 |
# Find files that are not readable |
165 |
find %{buildroot}/%{roundcube} -type f ! -perm /go+r -exec chmod -v go+r {} \; |
166 |
|
167 |
# |
168 |
# Exclude the following external libraries |
169 |
# |
170 |
# php-pear-Net-IDNA2 |
171 |
rm -rf %{buildroot}/%{roundcube}/program/lib/Net/IDNA2/ \ |
172 |
%{buildroot}/%{roundcube}/program/lib/Net/IDNA2.php |
173 |
# php-pear-Net-SMTP |
174 |
rm -rf %{buildroot}/%{roundcube}/program/lib/Net/SMTP.php |
175 |
# php-pear-Net-Socket |
176 |
rm -rf %{buildroot}/%{roundcube}/program/lib/Net/Socket.php |
177 |
# php-pear-Mail |
178 |
rm -rf %{buildroot}/%{roundcube}/program/lib/Mail/ |
179 |
# php-pear-MDB2 |
180 |
rm -rf %{buildroot}/%{roundcube}/program/lib/MDB2/ \ |
181 |
%{buildroot}/%{roundcube}/program/lib/MDB2.php |
182 |
# php-pear |
183 |
rm -rf %{buildroot}/%{roundcube}/program/lib/PEAR.php \ |
184 |
%{buildroot}/%{roundcube}/program/lib/PEAR5.php |
185 |
# php-pear-Net-Sieve |
186 |
rm -rf %{buildroot}/%{roundcube_plugins}/managesieve/lib/Net |
187 |
|
188 |
|
189 |
%pre |
190 |
# needed if you have kolab installed |
191 |
if [ -f "/etc/roundcubemail/kolab.inc.php" ]; then |
192 |
mv /etc/roundcubemail/kolab.inc.php /etc/roundcubemail/libkolab.inc.php |
193 |
fi |
194 |
|
195 |
if [ -L %{roundcube_plugins}/enigma/home -a ! -d %{roundcube_plugins}/enigma/home ]; then |
196 |
rm -rf %{roundcube_plugins}/enigma/home >/dev/null 2>&1 || : |
197 |
fi |
198 |
|
199 |
|
200 |
|
201 |
%post |
202 |
# replace default des string in config file for better security |
203 |
function makedesstr () { |
204 |
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 |
205 |
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) |
206 |
|
207 |
max=${#chars[*]} |
208 |
|
209 |
for i in `seq 1 24`; do |
210 |
let rand=${RANDOM}%%${max} |
211 |
str="${str}${chars[$rand]}" |
212 |
done |
213 |
echo $str |
214 |
} |
215 |
|
216 |
sed -i "s/rcmail-\!24ByteDESkey\*Str/`makedesstr`/" /etc/roundcubemail/defaults.inc.php || : &> /dev/null |
217 |
|
218 |
sed -i -r -e "s/.*(\s*define\(\s*'RCMAIL_VERSION'\s*,\s*').*('\);)/\1%{version}-%{release}\2/g" \ |
219 |
%{roundcube}/program/include/iniset.php || : |
220 |
|
221 |
if [ -f "%{php_inidir}/apc.ini" ]; then |
222 |
if [ ! -z "`grep ^apc.enabled=1 %{php_inidir}/apc.ini`" ]; then |
223 |
|
224 |
/sbin/systemctl condrestart %{httpd_name}.service |
225 |
|
226 |
fi |
227 |
fi |
228 |
|
229 |
/usr/share/roundcubemail/bin/updatedb.sh \ |
230 |
--dir /usr/share/doc/roundcubemail-%{version}/SQL/ \ |
231 |
--package roundcube || : \ |
232 |
>/dev/null 2>&1 |
233 |
|
234 |
exit 0 |
235 |
|
236 |
cat > README.urpmi <<EOF |
237 |
WARNING: when upgrading from <= 0.9.5 the old configuration files named |
238 |
main.inc.php and db.inc.php are now deprecated and should be replaced |
239 |
with one single config.inc.php file. Run the ./bin/update.sh script to |
240 |
get this conversion done or manually merge the files. |
241 |
Also see the UPGRADE file in the doc section. |
242 |
NOTE: the new config.inc.php should only contain options that differ |
243 |
from the ones listed in defaults.inc.php. |
244 |
EOF |
245 |
|
246 |
%files |
247 |
%doc CHANGELOG INSTALL LICENSE README.md SQL UPGRADING |
248 |
%{_datadir}/%{name} |
249 |
%dir %{_sysconfdir}/%{name} |
250 |
%attr(0640,root,apache)%{_logdir}/%{name} |
251 |
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} |
252 |
# Lets write out them specifically, so we can see when additional files are added (or deleted) |
253 |
%attr(0640,root,apache)%config(noreplace) %{_sysconfdir}/%{name}/acl.inc.php |
254 |
%attr(0640,root,apache)%config(noreplace) %{_sysconfdir}/%{name}/defaults.inc.php |
255 |
%attr(0640,root,apache)%config(noreplace) %{_sysconfdir}/%{name}/config.inc.php |
256 |
%attr(0640,root,apache)%config(noreplace) %{_sysconfdir}/%{name}/enigma.inc.php |
257 |
%attr(0640,root,apache)%config(noreplace) %{_sysconfdir}/%{name}/managesieve.inc.php |
258 |
%attr(0640,root,apache)%config(noreplace) %{_sysconfdir}/%{name}/mimetypes.php |
259 |
%attr(0640,root,apache)%config(noreplace) %{_sysconfdir}/%{name}/password.inc.php |
260 |
%config(noreplace) %{_webappconfdir}/%{name}.conf |
261 |
%attr(0770,root,apache) %dir %{_localstatedir}/lib/roundcubemail |
262 |
%attr(0770,root,apache) %dir %{_localstatedir}/lib/roundcubemail/plugins |
263 |
%attr(0770,root,apache) %dir %{_localstatedir}/lib/roundcubemail/plugins/enigma |
264 |
|