1 |
%define oname %{name}-%{version}-dep |
%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 |
Name: roundcubemail |
13 |
Version: 0.9.5 |
Version: 1.0.0 |
14 |
Release: %mkrel 1 |
Release: %mkrel 0.1 |
15 |
Summary: A PHP-based webmail server |
Summary: Round Cube Webmail is a browser-based multilingual IMAP client |
16 |
Group: System/Servers |
Group: System/Servers |
17 |
License: GPLv3 |
License: GPLv3 |
18 |
# Use the -dep tarballs. These use system copies of the PHP stuff |
# Use the -dep tarballs. These use system copies of the PHP stuff |
20 |
# - AdamW 2007/07 |
# - AdamW 2007/07 |
21 |
URL: http://www.roundcube.net/ |
URL: http://www.roundcube.net/ |
22 |
Source0: http://downloads.sourceforge.net/%{name}/%{oname}.tar.gz |
Source0: http://downloads.sourceforge.net/%{name}/%{oname}.tar.gz |
23 |
Epoch: 1 |
Source1: roundcubemail.conf |
24 |
#BuildRequires: apache-devel pcre-devel rpm-helper |
Source2: roundcubemail.logrotate |
25 |
|
#Epoch: 1 |
26 |
Requires: apache-mod_php |
Requires: apache-mod_php |
27 |
Requires: php-gd |
Requires: php-gd |
28 |
Requires: php-gettext |
Requires: php-gettext |
34 |
Requires: php-pdo_mysql |
Requires: php-pdo_mysql |
35 |
Requires: php-pear-Auth_SASL |
Requires: php-pear-Auth_SASL |
36 |
Requires: php-pear-Mail_Mime |
Requires: php-pear-Mail_Mime |
37 |
|
Requires: php-pear-Mail_mimeDecode) |
38 |
Requires: php-pear-Net_SMTP |
Requires: php-pear-Net_SMTP |
39 |
Requires: php-pear-Net_LDAP2 |
Requires: php-pear-Net_LDAP2 |
40 |
|
Requires: php-pear-Net_Sieve |
41 |
|
Requires: php-pear-Net_Socket |
42 |
Requires: php-pear-MDB2 |
Requires: php-pear-MDB2 |
43 |
Requires: php-pear-Net_IDNA2 |
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 |
# The installer suggests the use of these, but they're not |
49 |
# required - AdamW 2011/01 |
# required - AdamW 2011/01 |
50 |
Suggests: php-fileinfo |
Suggests: php-fileinfo |
51 |
Suggests: php-intl |
Suggests: php-intl |
|
# Most people will probably use mysql, but you can use sqlite or |
|
|
# pgsql, so not a hard require - AdamW 2008/10 |
|
52 |
Suggests: php-pear-MDB2_Driver_mysql |
Suggests: php-pear-MDB2_Driver_mysql |
53 |
|
Suggests: php-zip |
54 |
BuildArch: noarch |
BuildArch: noarch |
55 |
|
|
56 |
%description |
%description |
64 |
|
|
65 |
%prep |
%prep |
66 |
%setup -q -n %{oname} |
%setup -q -n %{oname} |
67 |
# tell it that we're moving the configuration files |
|
68 |
for i in installer/index.php program/include/iniset.php program/lib/Roundcube/bootstrap.php; do \ |
# remove any reference to sqlite in config file so people don't mistakely |
69 |
sed -i -e "s,INSTALL_PATH . 'config','%{_sysconfdir}/%{name}',g" $i; |
# assume it works |
70 |
sed -i -e "s,RCUBE_INSTALL_PATH . 'config','%{_sysconfdir}/%{name}',g" $i; |
sed -i '/sqlite/d' config/defaults.inc.php |
|
done |
|
|
# fixup paths to use the right paths and fix carriage returns |
|
|
sed -i 's,temp/,%{_tmppath},' config/main.inc.php.dist |
|
|
sed -i 's,config/,%{_sysconfdir}/%{name}/,' config/main.inc.php.dist |
|
|
sed -i 's,logs/,%{_logdir}/%{name}/,' config/main.inc.php.dist |
|
71 |
sed -i 's/\r//' SQL/mssql.initial.sql |
sed -i 's/\r//' SQL/mssql.initial.sql |
72 |
|
|
73 |
|
|
74 |
%build |
%build |
75 |
|
|
76 |
%install |
%install |
77 |
mkdir -p %{buildroot}%{_datadir}/%{name} |
install -d %{buildroot}%{roundcube} |
78 |
mkdir -p %{buildroot}%{_sysconfdir}/%{name} |
cp -pr ./* %{buildroot}%{roundcube} |
79 |
mkdir -p %{buildroot}%{_logdir}/%{name} |
cp -a ./.htaccess %{buildroot}%{roundcube}/.htaccess |
80 |
cp -a config/db.inc.php.dist %{buildroot}%{_sysconfdir}/%{name}/db.inc.php |
# Remove settings from .htaccess we don't want |
81 |
cp -a config/main.inc.php.dist %{buildroot}%{_sysconfdir}/%{name}/main.inc.php |
sed -i \ |
82 |
cp -a * %{buildroot}%{_datadir}/%{name} |
-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} |
mkdir -p %{buildroot}%{_webappconfdir} |
90 |
cat > %{buildroot}%{_webappconfdir}/%{name}.conf <<EOF |
cp -pr %SOURCE1 %{buildroot}%{_webappconfdir} |
|
Alias /%{name} %{_datadir}/%{name} |
|
91 |
|
|
|
<Directory %{_datadir}/%{name}> |
|
|
AllowOverride All |
|
|
<IfModule mod_authz_core.c> |
|
|
# Apache 2.4 |
|
|
<RequireAny> |
|
|
Require all granted |
|
|
</RequireAny> |
|
|
</IfModule> |
|
|
<IfModule !mod_authz_core.c> |
|
|
# Apache 2.2 |
|
|
Order allow,deny |
|
|
Allow from all |
|
|
</IfModule> |
|
|
</Directory> |
|
|
|
|
|
<Directory %{_datadir}/%{name}/SQL> |
|
|
AllowOverride All |
|
|
<IfModule mod_authz_core.c> |
|
|
# Apache 2.4 |
|
|
<RequireAny> |
|
|
Require all granted |
|
|
</RequireAny> |
|
|
</IfModule> |
|
|
<IfModule !mod_authz_core.c> |
|
|
# Apache 2.2 |
|
|
Order allow,deny |
|
|
Allow from all |
|
|
</IfModule> |
|
|
</Directory> |
|
92 |
|
|
93 |
php_value suhosin.session.encrypt Off |
mkdir -p %{buildroot}%{roundcube_conf} |
94 |
EOF |
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 |
cat > README.urpmi <<EOF |
# clean up the buildroot |
145 |
Mageia RPM specific notes |
rm -rf %{buildroot}%{roundcube}/{CHANGELOG,INSTALL,LICENSE,README,UPGRADING,SQL} |
146 |
|
|
147 |
setup |
# Fix anything executable that does not have a shebang |
148 |
----- |
for file in `find %{buildroot}/%{roundcube} -type f -perm /a+x`; do |
149 |
The setup used here differs from a standard installation in the following |
[ -z "`head -n 1 $file | grep \"^#!/\"`" ] && chmod -v 644 $file |
150 |
ways: |
done |
|
* Logs are stored to /var/log/roundcubemail |
|
|
* Temporary files are placed in /tmp |
|
|
* Configuration files (main.inc.php and db.inc.php) are placed in |
|
|
%{_sysconfdir}/roundcubemail |
|
|
|
|
|
configuration/upgrade |
|
|
------- |
|
|
Use the GUI to do the configuration/upgrade: |
|
|
RoundCube provides an installer which can help you to do all |
|
|
the installation/upgrade. The feature is disabled by default for |
|
|
security reasons but you can enable it in 'main.inc.php' by |
|
|
setting the 'enable_installer' variable to 'true'. |
|
|
Once done, browse http://server/roundcubemail/installer |
|
|
|
|
|
Use the CLI to do the configuration/upgrade: |
|
|
You will need to edit %{_sysconfdir}/roundcubemail/main.inc.php and |
|
|
%{_sysconfdir}/roundcubemail/db.inc.php appropriately for your site before you |
|
|
can use Roundcube. You must at least configure an appropriate mail |
|
|
server and port in main.inc.php, and change the |
|
|
$rcmail_config['des_key'] setting. In db.inc.php you must configure |
|
|
an appropriate database location and user; in the most simple |
|
|
configuration, you would create a new user and database both named |
|
|
'roundcubemail' on a MySQL server running on the same machine, give |
|
|
the roundcubemail user full read/write access to the roundcubemail |
|
|
database, and set db.inc.php appropriately. |
|
|
|
|
|
Information: |
|
|
- you can drop all of the tables and use the '*.initial.sql' file |
|
|
to fully recreate the database. |
|
|
- If any database change is needed, go to %{_datadir}/roundcubemail/SQL |
|
|
and use '*.update.sql' where '*' is your database backend type. |
|
|
EOF |
|
151 |
|
|
152 |
# clean up the buildroot |
# Find files with a shebang that do not have executable permissions |
153 |
rm -rf %{buildroot}%{_datadir}/%{name}/{config,logs,temp} |
for file in `find %{buildroot}/%{roundcube} -type f ! -perm /a+x`; do |
154 |
rm -rf %{buildroot}%{_datadir}/%{name}/{CHANGELOG,INSTALL,LICENSE,README,UPGRADING,SQL} |
[ ! -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 |
%files |
243 |
%doc CHANGELOG INSTALL LICENSE README.md SQL UPGRADING |
%doc CHANGELOG INSTALL LICENSE README.md SQL UPGRADING |
244 |
%{_datadir}/%{name} |
%{_datadir}/%{name} |
245 |
%dir %{_sysconfdir}/%{name} |
%dir %{_sysconfdir}/%{name} |
246 |
%attr(0740,root,apache)%{_logdir}/%{name} |
%attr(0640,root,apache)%{_logdir}/%{name} |
247 |
%attr(0640,root,apache)%config(noreplace) %{_sysconfdir}/%{name}/db.inc.php |
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} |
248 |
%attr(0640,root,apache)%config(noreplace) %{_sysconfdir}/%{name}/main.inc.php |
# 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 |
%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 |
|
|