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