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