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