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