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