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