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