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