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