1 |
# $Id: smeserver-mediawiki.spec,v 1.19 2022/12/01 15:06:30 brianr Exp $ |
2 |
# Authority: ber_die |
3 |
# Name: Dietmar Berteld |
4 |
|
5 |
%define name smeserver-mediawiki |
6 |
%define version 1.39.0 |
7 |
%define release 1 |
8 |
|
9 |
Summary: Mediawiki Web Application for SME Server 10.x based on Mediawiki 1.39.0 |
10 |
Name: %{name} |
11 |
Version: %{version} |
12 |
Release: %{release}%{?dist} |
13 |
License: GPL |
14 |
Group: /Web/Applications |
15 |
Source: %{name}-%{version}.tar.gz |
16 |
|
17 |
#Patch0: smeserver-mediawiki-1.38.2-bz12133-httpd24.patch |
18 |
#Patch1: smeserver-mediawiki-1.38.2-bz12134-backup.patch |
19 |
|
20 |
URL: http://mediawiki.org/ |
21 |
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot |
22 |
BuildArch: noarch |
23 |
Requires: e-smith-base, e-smith-release >= 10 |
24 |
Requires: e-smith-apache >= 2.6.0-19 |
25 |
Requires: smeserver-php >= 3.0.0-43 |
26 |
BuildRequires: e-smith-devtools |
27 |
|
28 |
%description |
29 |
This RPM is an addon for the SME Server v10 |
30 |
The target audience is the Linux/E-smith administrator |
31 |
who wants to add Wikipedia-SW. |
32 |
Mediawiki is a very popular Wiki and is used by the wikipedia-project. |
33 |
After installation open your webbrowser your local site |
34 |
http://your_e-smith-server_adress/wiki |
35 |
|
36 |
%changelog |
37 |
|
38 |
* Thu Dec 01 2022 Brian Read <brianr@bjsystems.co.uk> 1.39.0-1.sme |
39 |
- Update to LTS version 1.39.0 (Supported until dec 2025)[SME: 12250] |
40 |
|
41 |
* Tue Aug 02 2022 Jean-Philippe Pialasse <tests@pialasse.com> 1.38.2-2.sme |
42 |
- update to httpd 2.4 access syntax [SME: 12133] |
43 |
- add to core backup [SME: 12134] |
44 |
|
45 |
* Tue Jul 12 2022 Brian Read <brianr@bjsystems.co.uk> 1.38.2-1.sme |
46 |
- Update version to Mediawiki-1.38.2 [sme: 11987] |
47 |
- Fix initial admin user password |
48 |
|
49 |
* Thu Jun 09 2022 Brian Read <brianr@bjsystems.co.uk> 1.38.1-2.sme |
50 |
- fix sql user create [SME: 11987] |
51 |
|
52 |
* Wed Jun 08 2022 Brian Read <brianr@bjsystems.co.uk> 1.38.0-2.sme |
53 |
- Update version to Mediawiki-1.38.1 [sme: 11987] |
54 |
|
55 |
* Fri Jun 03 2022 Brian Read <brianr@bjsystems.co.uk> 1.38.0-2.sme |
56 |
- update sql create [SME: 11987] |
57 |
|
58 |
* Fri Jun 03 2022 Brian Read <brianr@bjsystems.co.uk> 1.38.0-1.sme |
59 |
- Rollup tar file to include mediawiki 1.38.0 [SME: 11987] |
60 |
|
61 |
* Wed Jun 01 2022 Brian Read <brianr@bjsystems.co.uk> 1.37.2-3.sme |
62 |
- Fix-up-password-generation-and-localsettings [SME: 11987] |
63 |
|
64 |
* Wed Jun 01 2022 BogusDateBot |
65 |
- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday, |
66 |
by assuming the date is correct and changing the weekday. |
67 |
Thu Oct 23 2007 --> Thu Oct 18 2007 or Tue Oct 23 2007 or Thu Oct 25 2007 or .... |
68 |
Thu Feb 26 2008 --> Thu Feb 21 2008 or Tue Feb 26 2008 or Thu Feb 28 2008 or .... |
69 |
|
70 |
* Tue May 31 2022 Brian Read <brianr@bjsystems.co.uk> 1.6.10-10 sme |
71 |
- Update to SME10 [SME:11987] |
72 |
- Add php-fpm stuff to httpd.conf |
73 |
- Update to mw 1.37.2 |
74 |
|
75 |
* Mon May 12 2008 Dietmar Berteld> 1.6.10-9 |
76 |
- Disabing automatic creation of SME groups. No idea to synchronise them to mediawiki groups. |
77 |
|
78 |
* Mon May 12 2008 Dietmar Berteld> 1.6.10-8 |
79 |
- Adding PwAuth-function, SME users can login with their SME passwords |
80 |
Automatic creation of a few default mw_groups and list them in the |
81 |
configuration file as well so admins only need to add users to the proper |
82 |
groups in the server-manager |
83 |
|
84 |
* Tue Feb 26 2008 Dietmar Berteld> |
85 |
Thu Feb 26 2008 --> Thu Feb 21 2008 or Tue Feb 26 2008 or Thu Feb 28 2008 or .... |
86 |
- [1.6.10-7] Fixed httpd-settings for local access only |
87 |
|
88 |
* Tue Oct 23 2007 Dietmar Berteld> |
89 |
Thu Oct 23 2007 --> Thu Oct 18 2007 or Tue Oct 23 2007 or Thu Oct 25 2007 or .... |
90 |
- [1.6.10-6] Fixed automated uninstall issue for MySQL-DB and MySQL-user |
91 |
|
92 |
* Fri Oct 19 2007 Dietmar Berteld> |
93 |
- [1.6.10-5] Fixed short URL's |
94 |
- Improved Apache template for better security |
95 |
- Improved integration in SME (PublicAccess local/global - global) |
96 |
|
97 |
* Wed Oct 10 2007 Sylvain Gomez <sylvaingomez@free.fr> |
98 |
- [1.6.10-4] Fixed short URL's |
99 |
Fixed Apache restarting at the wrong time while uninstalling |
100 |
Added missing MySQL User |
101 |
Added automatic lang detection at install stage |
102 |
Changed sme.png logo |
103 |
|
104 |
* Wed Sep 05 2007 Dietmar Berteld <dietmar@berteld.com> |
105 |
- [1.6.10-3] Simpler method to create MySQL-Datebase |
106 |
Using short URL's |
107 |
|
108 |
* Wed Apr 25 2007 Dietmar Berteld <dietmar@berteld.com> |
109 |
- [1.6.10-2] Security Improvements (template, MySQL, directory-rights) |
110 |
Thanks for the help to Sylvain Gomez <sylvain.gomez@free.fr> |
111 |
|
112 |
* Thu Apr 12 2007 Dietmar Berteld <dietmar@berteld.com> |
113 |
- [1.6.10-1] Initial version |
114 |
|
115 |
%prep |
116 |
rm -rf $RPM_BUILD_ROOT |
117 |
|
118 |
%setup |
119 |
|
120 |
#%patch0 -p1 |
121 |
#%patch1 -p1 |
122 |
|
123 |
%build |
124 |
perl createlinks |
125 |
|
126 |
%install |
127 |
rm -rf $RPM_BUILD_ROOT |
128 |
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT) |
129 |
rm -f %{name}-%{version}-filelist |
130 |
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT > %{name}-%{version}-filelist |
131 |
|
132 |
%clean |
133 |
rm -rf $RPM_BUILD_ROOT |
134 |
|
135 |
%pre |
136 |
|
137 |
UPDATE=$(ls /opt | grep -c mediawiki) |
138 |
case $UPDATE in |
139 |
0) |
140 |
echo "Installing MediaWiki... Please wait!" |
141 |
;; |
142 |
*) |
143 |
echo "Updating MediaWiki... Please wait!" |
144 |
mkdir -p /opt/MW_RPM_BACKUP |
145 |
cd /opt |
146 |
echo "Backing up installation files..." |
147 |
tar -czf /opt/MW_RPM_BACKUP/mediawiki.tar.gz mediawiki |
148 |
echo "Backing up MySQL database..." |
149 |
mysqldump mediawiki > /opt/MW_RPM_BACKUP/mediawiki.sql |
150 |
/sbin/e-smith/db configuration show mediawiki > /opt/MW_RPM_BACKUP/config.txt |
151 |
;; |
152 |
esac |
153 |
|
154 |
%post |
155 |
|
156 |
# General Information |
157 |
/etc/e-smith/events/actions/initialize-default-databases |
158 |
# General Information |
159 |
APP=MediaWiki |
160 |
URL=wiki |
161 |
WORKDIR=/root |
162 |
MEDIAWIKIVERSION='1.39.0' |
163 |
INSTALLDIR=/usr/share/doc/mediawiki-$MEDIAWIKIVERSION/Sources |
164 |
HTMLDIR=/opt/mediawiki |
165 |
MYSQLDB=mediawiki |
166 |
MYSQLUSER=mediawikiuser |
167 |
MYSQLPASS=$(/sbin/e-smith/db configuration getprop mediawiki DbPassword) |
168 |
DOMAIN=$(/sbin/e-smith/db configuration get DomainName) |
169 |
SRVNAME=$(/sbin/e-smith/db configuration get SystemName) |
170 |
UPDATE=$(ls /opt | grep -c mediawiki) |
171 |
grep "LANG=" /etc/sysconfig/i18n > lang1 |
172 |
sed -e 's/LANG="//g' lang1 > lang2 |
173 |
sed -e 's/"//g' lang2 > lang |
174 |
LANG=$(cat lang) |
175 |
rm -rf lang* |
176 |
#Untar application |
177 |
echo "Decompressing files..." |
178 |
mkdir -p $HTMLDIR |
179 |
tar xzf $INSTALLDIR/mediawiki-$MEDIAWIKIVERSION.tar.gz -C /opt |
180 |
case $UPDATE in |
181 |
0) mv -f /opt/mediawiki-$MEDIAWIKIVERSION/* $HTMLDIR ;; |
182 |
*) cp -ufR /opt/mediawiki-$MEDIAWIKIVERSION/* $HTMLDIR ;; |
183 |
esac |
184 |
rm -rf /opt/mediawiki-$MEDIAWIKIVERSION |
185 |
cp $INSTALLDIR/sme.* $HTMLDIR/skins/common/images |
186 |
#Prepare config settings |
187 |
sed 's.mediawikipassword.'$MYSQLPASS'.g' $INSTALLDIR/LocalSettings.php > $HTMLDIR/LocalSettings.php |
188 |
sed "s/mydomain/$DOMAIN/g" $HTMLDIR/LocalSettings.php > $HTMLDIR/LocalSettings1.php |
189 |
sed "s/myhost/$SRVNAME/g" $HTMLDIR/LocalSettings1.php > $HTMLDIR/LocalSettings2.php |
190 |
case "$LANG" in |
191 |
de_DE) sed 's.$wgLanguageCode = "en";.$wgLanguageCode = "de";.g' $HTMLDIR/LocalSettings2.php > $HTMLDIR/LocalSettings.php ;; |
192 |
es_ES) sed 's.$wgLanguageCode = "en";.$wgLanguageCode = "es";.g' $HTMLDIR/LocalSettings2.php > $HTMLDIR/LocalSettings.php ;; |
193 |
fr_FR) sed 's.$wgLanguageCode = "en";.$wgLanguageCode = "fr";.g' $HTMLDIR/LocalSettings2.php > $HTMLDIR/LocalSettings.php ;; |
194 |
it_IT) sed 's.$wgLanguageCode = "en";.$wgLanguageCode = "it";.g' $HTMLDIR/LocalSettings2.php > $HTMLDIR/LocalSettings.php ;; |
195 |
*) sed 's.$wgLanguageCode = "en";.$wgLanguageCode = "en";.g' $HTMLDIR/LocalSettings2.php > $HTMLDIR/LocalSettings.php ;; |
196 |
esac |
197 |
rm $HTMLDIR/LocalSettings1.php |
198 |
rm $HTMLDIR/LocalSettings2.php |
199 |
#cp $INSTALLDIR/PwAuthPlugin.php $HTMLDIR/extensions/PwAuthPlugin.php |
200 |
#Creating SME-Groups for MediaWiki (disabled) |
201 |
#/sbin/e-smith/db accounts set mw_read group |
202 |
#/sbin/e-smith/db accounts setprop mw_read Description "MediaWiki Read" |
203 |
#/sbin/e-smith/db accounts set mw_edit group |
204 |
#/sbin/e-smith/db accounts setprop mw_edit Description "MediaWiki Edit" |
205 |
#/sbin/e-smith/db accounts set mw_createpage group |
206 |
#/sbin/e-smith/db accounts setprop mw_createpage Description "MediaWiki Create Page" |
207 |
#/sbin/e-smith/db accounts set mw_createtalk group |
208 |
#/sbin/e-smith/db accounts setprop mw_createtalk Description "MediaWiki Create Talk" |
209 |
#/sbin/e-smith/signal-event group-create |
210 |
#Changing some rights |
211 |
chmod 644 $HTMLDIR/extensions/PwAuthPlugin.php |
212 |
chown -R root:root $HTMLDIR |
213 |
chown root:www $HTMLDIR/images |
214 |
chown root:www $HTMLDIR/LocalSettings.php |
215 |
chmod 775 $HTMLDIR/images |
216 |
chmod 440 $HTMLDIR/LocalSettings.php |
217 |
#Creating DataBase |
218 |
echo "MySQL installation:" |
219 |
case $UPDATE in |
220 |
0) |
221 |
echo "Creating MySQL User and DataBase..." |
222 |
mysqladmin -u root create $MYSQLDB |
223 |
mysql $MYSQLDB < $INSTALLDIR/$MYSQLDB.sql |
224 |
mysql $MYSQLDB -e "UPDATE user SET user_password = MD5( CONCAT( user_id, '-', MD5( 'mediawikiadmin' ) ) ) WHERE user_id =1 " |
225 |
mysql -u root -e "SET PASSWORD FOR $MYSQLUSER@localhost = PASSWORD( '$MYSQLPASS' ) " |
226 |
mysqladmin flush-privileges |
227 |
;; |
228 |
*) |
229 |
echo "Fixing MySQL rights..." |
230 |
mysql -u root -e "SET PASSWORD FOR $MYSQLUSER@localhost = PASSWORD( '$MYSQLPASS' ) " |
231 |
mysqladmin flush-privileges |
232 |
;; |
233 |
esac |
234 |
# Rebuilding Wiki language menus |
235 |
#php $HTMLDIR/maintenance/rebuildMessages.php --rebuild |
236 |
#echo "Applying modifications to services..." |
237 |
# Uncomment the PwAuth-function |
238 |
sed 's.#!..g' $HTMLDIR/LocalSettings.php > $HTMLDIR/LocalSettings2.php |
239 |
mv $HTMLDIR/LocalSettings2.php $HTMLDIR/LocalSettings.php |
240 |
#Handled in the -update event |
241 |
#/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf |
242 |
#systemctl restart httpd-e-smith.service |
243 |
echo "-------------------------------------------------------------------------------" |
244 |
case $UPDATE in |
245 |
0) |
246 |
echo "$APP Installation completed." |
247 |
echo "Reminder:" |
248 |
echo "- Website open globally" |
249 |
echo "- go to http://$DOMAIN/$URL" |
250 |
#echo "- Usernames are identical with SME users" |
251 |
#echo "- Passwords are identical with SME passwords" |
252 |
echo "- MediaWiki admin = SME admin" |
253 |
;; |
254 |
*) |
255 |
echo "$APP update completed." |
256 |
echo "Reminder:" |
257 |
echo "- The old install was backed up and can be found in /opt/MW_RPM_BACKUP" |
258 |
echo " PLEASE MOVE THIS DIRECTORY TO A SAFE PLACE!!!" |
259 |
echo "- Website open globally" |
260 |
echo "- go to http://$DOMAIN/$URL" |
261 |
#echo "- Usernames are identical with SME users" |
262 |
#echo "- Passwords are identical with SME passwords" |
263 |
echo "- MediaWiki admin = SME admin" |
264 |
;; |
265 |
esac |
266 |
echo "-------------------------------------------------------------------------------" |
267 |
echo "Following DB parameters are allowed:" |
268 |
echo " # config setprop $MYSQLDB HTTPS on/off" |
269 |
echo " # config setprop $MYSQLDB PublicAccess local/global" |
270 |
echo " " |
271 |
echo "Don't forget to apply modifications with following commands:" |
272 |
echo " # expand-template /etc/httpd/conf/httpd.conf" |
273 |
echo " # systemctl restart httpd-e-smith.service" |
274 |
echo " " |
275 |
echo "For more details, see http://wiki.contribs.org/Mediawiki" |
276 |
echo "-------------------------------------------------------------------------------" |
277 |
|
278 |
%preun |
279 |
MEDIAWIKIVERSION='1.39.0' |
280 |
INSTALLDIR=/usr/share/doc/mediawiki-$MEDIAWIKIVERSION/Sources |
281 |
if [ $1 = 0 ] ; then |
282 |
mv $INSTALLDIR/DO_NOT_USE_OR_DELETE/MW-Full-Uninstall.sh /root/ |
283 |
fi |
284 |
|
285 |
%postun |
286 |
if [ $1 = 0 ] ; then |
287 |
echo "Restarting services..." |
288 |
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf |
289 |
#/usr/local/bin/svc -h /service/httpd-e-smith |
290 |
systemctl restart httpd-e-smith.service |
291 |
echo " " |
292 |
echo "Uninstallation finished!" |
293 |
echo "If you want to completly remove it (installation files and MySQL user+database)" |
294 |
echo "please issue the following command at the prompt:" |
295 |
echo "# sh /root/MW-Full-Uninstall.sh" |
296 |
fi |
297 |
|
298 |
%files -f %{name}-%{version}-filelist |
299 |
|
300 |
%defattr(-,root,root) |