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