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