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