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