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