1 |
unnilennium |
1.1 |
# $Id: smeserver-phpbb.spec,v 1.4 2008/11/25 16:20:27 slords Exp $ |
2 |
|
|
# Authority: nocvs |
3 |
|
|
# Name: Dietmar Berteld |
4 |
|
|
|
5 |
|
|
%define name smeserver-phpbb |
6 |
|
|
%define version 2.0.22 |
7 |
|
|
%define release 2 |
8 |
|
|
%define rpmver 4.0.4 |
9 |
|
|
|
10 |
|
|
Summary: phpBB Forum Web Application for SME Server 7.x based on phpBB-2.0.22 |
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 Web Forum package . |
27 |
|
|
PhpBB has become the most widely used Open Source forum solution. With a large and highly |
28 |
|
|
customisable set of key features coupled with a standards compliant interface, phpBB will |
29 |
|
|
grow with, and compliment your website. With millions of installations worldwide, it is no |
30 |
|
|
wonder phpBB is one of the most popular ways to create and support a community. |
31 |
|
|
https://your_e-smith-server_adress/forum |
32 |
|
|
|
33 |
|
|
|
34 |
|
|
%changelog |
35 |
|
|
* Tue May 29 2007 Dietmar Berteld <dietmar@berteld.com> |
36 |
|
|
- [2.0.22-2] Change MySQL-creating method to SME and fixing bugs |
37 |
|
|
|
38 |
|
|
* Fri May 11 2007 Dietmar Berteld <dietmar@berteld.com> |
39 |
|
|
- [2.0.22-1] Initial version |
40 |
|
|
|
41 |
|
|
%prep |
42 |
|
|
rm -rf $RPM_BUILD_ROOT |
43 |
|
|
|
44 |
|
|
%setup |
45 |
|
|
|
46 |
|
|
%build |
47 |
|
|
|
48 |
|
|
%install |
49 |
|
|
/bin/rm -rf $RPM_BUILD_ROOT |
50 |
|
|
(/usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT) |
51 |
|
|
/bin/rm -f %{name}-%{version}-filelist |
52 |
|
|
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT > %{name}-%{version}-filelist |
53 |
|
|
|
54 |
|
|
|
55 |
|
|
%files -f %{name}-%{version}-filelist |
56 |
|
|
|
57 |
|
|
%defattr(-,root,root) |
58 |
|
|
|
59 |
|
|
%clean |
60 |
|
|
rm -rf $RPM_BUILD_ROOT |
61 |
|
|
|
62 |
|
|
%pre |
63 |
|
|
|
64 |
|
|
%post |
65 |
|
|
|
66 |
|
|
# General Information |
67 |
|
|
APP=phpBB |
68 |
|
|
URL=forum |
69 |
|
|
WORKDIR=/root |
70 |
|
|
HTMLDIR=/opt/phpBB2 |
71 |
|
|
MYSQLDB=phpbb |
72 |
|
|
MYSQLUSER=phpbbuser |
73 |
|
|
|
74 |
|
|
GATEWAY=$(/sbin/e-smith/db configuration get GatewayIP) |
75 |
|
|
LOCALIP=$(/sbin/e-smith/db configuration get LocalIP) |
76 |
|
|
LOCMASK=$(/sbin/e-smith/db configuration get LocalNetmask) |
77 |
|
|
DOMAINE=$(/sbin/e-smith/db configuration get DomainName) |
78 |
|
|
SRVMODE=$(/sbin/e-smith/db configuration get SystemMode) |
79 |
|
|
SRVNAME=$(/sbin/e-smith/db configuration get SystemName) |
80 |
|
|
if [ "$SRVMODE" = "servergateway" ]; then |
81 |
|
|
OUTERIP=$(/sbin/e-smith/db configuration get ExternalIP) |
82 |
|
|
OUTMASK=$(/sbin/e-smith/db configuration get ExternalNetmask) |
83 |
|
|
fi |
84 |
|
|
TIMEZONE=$(/sbin/e-smith/db configuration get TimeZone) |
85 |
|
|
|
86 |
|
|
|
87 |
|
|
# Untar the application to /opt |
88 |
|
|
echo "Untar the application to $HTMLDIR" |
89 |
|
|
cd /opt |
90 |
|
|
tar xfz phpBB-2.0.22.tar.gz |
91 |
|
|
tar xfz lang_french.tar.gz |
92 |
|
|
tar xfz lang_german.tar.gz |
93 |
|
|
tar xfz lang_italian.tar.gz |
94 |
|
|
tar xfz lang_spanish.tar.gz |
95 |
|
|
tar xfz lang_swedish.tar.gz |
96 |
|
|
rm -rf *.tar.gz |
97 |
|
|
mv lang* $HTMLDIR/language |
98 |
|
|
rm -rf /smeserver-phpbb-2.0.22-2.spec |
99 |
|
|
|
100 |
|
|
|
101 |
|
|
# Configuration of domain-settings |
102 |
|
|
sed -e "s/'youraddress@yourdomain.com'/'admin@$DOMAINE'/" $HTMLDIR/phpbb.sql >$HTMLDIR/phpbb.sql.new |
103 |
|
|
sed -e "s/'yourdomain.com'/'$DOMAINE'/" $HTMLDIR/phpbb.sql.new >$HTMLDIR/phpbb.sql |
104 |
|
|
sed -e "s/'A _little_ text to describe your forum'/'$DOMAINE'/" $HTMLDIR/phpbb.sql >$HTMLDIR/phpbb.sql.new |
105 |
|
|
sed -e "s/'www.myserver.tld'/'$DOMAINE'/" $HTMLDIR/phpbb.sql.new >$HTMLDIR/phpbb.sql |
106 |
|
|
|
107 |
|
|
case "$LANG" in |
108 |
|
|
de_DE) sed -e "s/'english'/'german'/" $HTMLDIR/phpbb.sql >$HTMLDIR/phpbb.sql.new ;; |
109 |
|
|
en_US) sed -e "s/'english'/'english'/" $HTMLDIR/phpbb.sql >$HTMLDIR/phpbb.sql.new ;; |
110 |
|
|
es_ES) sed -e "s/'english'/'spanish'/" $HTMLDIR/phpbb.sql >$HTMLDIR/phpbb.sql.new ;; |
111 |
|
|
fr_FR) sed -e "s/'english'/'french'/" $HTMLDIR/phpbb.sql >$HTMLDIR/phpbb.sql.new ;; |
112 |
|
|
it_IT) sed -e "s/'english'/'italian'/" $HTMLDIR/phpbb.sql >$HTMLDIR/phpbb.sql.new ;; |
113 |
|
|
sv_FI) sed -e "s/'english'/'swedish'/" $HTMLDIR/phpbb.sql >$HTMLDIR/phpbb.sql.new ;; |
114 |
|
|
esac |
115 |
|
|
|
116 |
|
|
|
117 |
|
|
# Creating the database |
118 |
|
|
echo "Creating database '$MYSQLDB' and user '$MYSQLUSER'" |
119 |
|
|
/etc/e-smith/events/actions/initialize-default-databases |
120 |
|
|
mysqladmin -u root create $MYSQLDB |
121 |
|
|
mysql $MYSQLDB < $HTMLDIR/phpbb.sql.new |
122 |
|
|
MYSQLPASS=$(/sbin/e-smith/config getprop $MYSQLDB DbPassword) |
123 |
|
|
mysql -u root -e "SET PASSWORD FOR $MYSQLUSER@localhost = PASSWORD( '$MYSQLPASS' ) " |
124 |
|
|
mysqladmin flush-privileges |
125 |
|
|
/etc/rc.d/init.d/mysql.init start |
126 |
|
|
|
127 |
|
|
|
128 |
|
|
# Deleting some folders and creation of config.php |
129 |
|
|
rm -rf $HTMLDIR/contrib |
130 |
|
|
rm -rf $HTMLDIR/docs |
131 |
|
|
rm -rf $HTMLDIR/install |
132 |
|
|
rm -rf $HTMLDIR/phpbb.sql |
133 |
|
|
rm -rf $HTMLDIR/phpbb.sql.new |
134 |
|
|
|
135 |
|
|
echo "<?php" > $HTMLDIR/config.php |
136 |
|
|
echo >> $HTMLDIR/config.php |
137 |
|
|
echo >> $HTMLDIR/config.php |
138 |
|
|
echo "// phpBB 2.x auto-generated config file" >> $HTMLDIR/config.php |
139 |
|
|
echo "// Do not change anything in this file!" >> $HTMLDIR/config.php |
140 |
|
|
echo >> $HTMLDIR/config.php |
141 |
|
|
echo "\$dbms = 'mysql4';" >> $HTMLDIR/config.php |
142 |
|
|
echo >> $HTMLDIR/config.php |
143 |
|
|
echo "\$dbhost = 'localhost';" >> $HTMLDIR/config.php |
144 |
|
|
echo "\$dbname = '$MYSQLDB';" >> $HTMLDIR/config.php |
145 |
|
|
echo "\$dbuser = '$MYSQLUSER';" >> $HTMLDIR/config.php |
146 |
|
|
echo "\$dbpasswd = '$MYSQLPASS';" >> $HTMLDIR/config.php |
147 |
|
|
echo >> $HTMLDIR/config.php |
148 |
|
|
echo "\$table_prefix = 'phpbb_';" >> $HTMLDIR/config.php |
149 |
|
|
echo >> $HTMLDIR/config.php |
150 |
|
|
echo "define('PHPBB_INSTALLED', true);" >> $HTMLDIR/config.php |
151 |
|
|
echo >> $HTMLDIR/config.php |
152 |
|
|
echo "?>" >> $HTMLDIR/config.php |
153 |
|
|
|
154 |
|
|
|
155 |
|
|
# Change rights |
156 |
|
|
cd /opt |
157 |
|
|
chown -R root.root $HTMLDIR |
158 |
|
|
find $HTMLDIR -type d -exec chmod 555 {} \; |
159 |
|
|
find $HTMLDIR -type f -exec chmod 444 {} \; |
160 |
|
|
chmod 777 $HTMLDIR/images/avatars |
161 |
|
|
|
162 |
|
|
|
163 |
|
|
# Custom template fragment and restart services |
164 |
|
|
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf |
165 |
|
|
/etc/rc7.d/S86httpd-e-smith sigusr1 |
166 |
|
|
mysqladmin flush-privileges |
167 |
|
|
/etc/rc.d/init.d/mysql.init start |
168 |
|
|
|
169 |
|
|
|
170 |
|
|
echo "=======================================================================" |
171 |
|
|
echo "$APP Installation finished. " |
172 |
|
|
echo "go to http://$DOMAINE/$URL" |
173 |
|
|
echo "Username : admin" |
174 |
|
|
echo "Password : admin" |
175 |
|
|
echo " " |
176 |
|
|
echo "Please change the admin-password !! " |
177 |
|
|
echo "=======================================================================" |
178 |
|
|
|
179 |
|
|
|
180 |
|
|
%preun |
181 |
|
|
# General Information |
182 |
|
|
APP=phpBB |
183 |
|
|
URL=forum |
184 |
|
|
WORKDIR=/root |
185 |
|
|
HTMLDIR=/opt/phpBB2 |
186 |
|
|
MYSQLDB=phpbb |
187 |
|
|
MYSQLUSER=phpbbuser |
188 |
|
|
|
189 |
|
|
|
190 |
|
|
# This section deletes the database |
191 |
|
|
echo "Deleting database '$MYSQLDB' and user '$MYSQLUSER'" |
192 |
|
|
mysql -u root -e "DROP DATABASE $MYSQLDB" |
193 |
|
|
mysql -u root -e "REVOKE ALL PRIVILEGES ON $MYSQLDB.* FROM '$MYSQLUSER'@'localhost';" |
194 |
|
|
mysql -u root -e "DROP USER $MYSQLUSER@localhost;" |
195 |
|
|
|
196 |
|
|
|
197 |
|
|
# Delete folder $HTMLDIR |
198 |
|
|
echo "Deleting folder '$HTMLDIR'" |
199 |
|
|
rm -rf $HTMLDIR |
200 |
|
|
|
201 |
|
|
# Delete custom template fragment |
202 |
|
|
/sbin/e-smith/config delete $MYSQLDB |
203 |
|
|
/sbin/e-smith/expand-template etc/httpd/conf/httpd.conf |
204 |
|
|
/etc/rc7.d/S86httpd-e-smith sigusr1 |
205 |
|
|
|
206 |
|
|
%postun |
207 |
|
|
|
208 |
|
|
|