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