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