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