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