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