1 |
# $Id: smeserver-smf.spec,v 1.2 2008/04/02 15:03:59 slords Exp $ |
2 |
# Authority: cool34000 |
3 |
# Name: Sylvain Gomez |
4 |
|
5 |
%define name smeserver-smf |
6 |
%define version 1.1.4 |
7 |
%define release 1 |
8 |
%define rpmver 4.0.4 |
9 |
|
10 |
Summary: SMF is a php web-based forum |
11 |
Name: %{name} |
12 |
Version: %{version} |
13 |
Release: %{release}%{?dist} |
14 |
License: GPL |
15 |
Group: Web/Application |
16 |
Source: %{name}-%{version}.tar.gz |
17 |
URL: http://www.simplemachines.org/ |
18 |
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot |
19 |
BuildArchitectures: noarch |
20 |
BuildRequires: e-smith-devtools |
21 |
Requires: e-smith-base, e-smith-release >= 7 |
22 |
|
23 |
%description |
24 |
This RPM is an unofficial addon for the SME Server 7.x. |
25 |
Simple Machines Forum SMF in short is a free, professional grade software |
26 |
package that allows you to set up your own online community within minutes. |
27 |
http://yourdomain.com/forum |
28 |
|
29 |
%changelog |
30 |
* Thu Oct 11 2007 Sylvain Gomez <sylvaingomez@free.fr> |
31 |
- 1.1.4-1 |
32 |
Original version |
33 |
|
34 |
%prep |
35 |
rm -rf $RPM_BUILD_ROOT |
36 |
|
37 |
%setup |
38 |
|
39 |
%build |
40 |
|
41 |
%install |
42 |
/bin/rm -rf $RPM_BUILD_ROOT |
43 |
(/usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT) |
44 |
/bin/rm -f %{name}-%{version}-filelist |
45 |
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT > %{name}-%{version}-filelist |
46 |
|
47 |
%files -f %{name}-%{version}-filelist |
48 |
|
49 |
%defattr(-,root,root) |
50 |
|
51 |
%clean |
52 |
rm -rf $RPM_BUILD_ROOT |
53 |
|
54 |
%pre |
55 |
|
56 |
%post |
57 |
# Adding SMF to SME's db |
58 |
/etc/e-smith/events/actions/initialize-default-databases |
59 |
echo " " |
60 |
|
61 |
# Variables |
62 |
SMFPASS=$(/sbin/e-smith/db configuration getprop SMF DbPassword) |
63 |
DOMAIN=$(/sbin/e-smith/db configuration get DomainName) |
64 |
|
65 |
echo "Decompressing files..." |
66 |
cd /opt |
67 |
tar xfz SMF.tar.gz |
68 |
rm SMF.tar.gz |
69 |
|
70 |
echo "Creating MySQL user and DataBase..." |
71 |
mysqladmin -u root create smf |
72 |
mysql -e " grant select, insert, update, delete, alter, index, create, drop on smf.* to 'smf'@'localhost' " |
73 |
mysql -u root -e " SET PASSWORD FOR smf@localhost = PASSWORD( '$SMFPASS' ) " |
74 |
mysqladmin flush-privileges |
75 |
|
76 |
echo "Importing MySQL DataBase..." |
77 |
sed -e "s/yourdomain.com/$DOMAIN/" /opt/SMF.sql >/opt/SMF_1.sql |
78 |
mysql smf < /opt/SMF_1.sql |
79 |
rm -f /opt/SMF.sql |
80 |
rm -f /opt/SMF_1.sql |
81 |
|
82 |
# Changing password and domain-name in Settings.php |
83 |
sed -e "s/yourdomain.com/$DOMAIN/" /opt/SMF/Settings.php >/opt/SMF/Settings.php.new |
84 |
sed 's.smfpassword.'$SMFPASS'.g' /opt/SMF/Settings.php.new >/opt/SMF/Settings.php |
85 |
case "$LANG" in |
86 |
de_DE) sed -e "s/english/german-utf8/" /opt/SMF/Settings.php >/opt/SMF/Settings.php.new ;; |
87 |
es_ES) sed -e "s/english/spanish-utf8/" /opt/SMF/Settings.php >/opt/SMF/Settings.php.new ;; |
88 |
fr_FR) sed -e "s/english/french-utf8/" /opt/SMF/Settings.php >/opt/SMF/Settings.php.new ;; |
89 |
it_IT) sed -e "s/english/italian-utf8/" /opt/SMF/Settings.php >/opt/SMF/Settings.php.new ;; |
90 |
sv_FI) sed -e "s/english/swedish-utf8/" /opt/SMF/Settings.php >/opt/SMF/Settings.php.new ;; |
91 |
*) sed -e "s/english/english/" /opt/SMF/Settings.php >/opt/SMF/Settings.php.new ;; |
92 |
esac |
93 |
mv -f /opt/SMF/Settings.php.new /opt/SMF/Settings.php |
94 |
chown root:www /opt/SMF/Settings.php |
95 |
chmod 664 /opt/SMF/Settings.php |
96 |
|
97 |
# Changing password and domain-name in Settings_bak.php |
98 |
sed -e "s/yourdomain.com/$DOMAIN/" /opt/SMF/Settings_bak.php >/opt/SMF/Settings_bak.php.new |
99 |
sed 's.smfpassword.'$SMFPASS'.g' /opt/SMF/Settings_bak.php.new >/opt/SMF/Settings_bak.php |
100 |
case "$LANG" in |
101 |
de_DE) sed -e "s/english/german-utf8/" /opt/SMF/Settings_bak.php >/opt/SMF/Settings_bak.php.new ;; |
102 |
es_ES) sed -e "s/english/spanish-utf8/" /opt/SMF/Settings_bak.php >/opt/SMF/Settings_bak.php.new ;; |
103 |
fr_FR) sed -e "s/english/french-utf8/" /opt/SMF/Settings_bak.php >/opt/SMF/Settings_bak.php.new ;; |
104 |
it_IT) sed -e "s/english/italian-utf8/" /opt/SMF/Settings_bak.php >/opt/SMF/Settings_bak.php.new ;; |
105 |
sv_FI) sed -e "s/english/swedish-utf8/" /opt/SMF/Settings_bak.php >/opt/SMF/Settings_bak.php.new ;; |
106 |
*) sed -e "s/english/english/" /opt/SMF/Settings_bak.php >/opt/SMF/Settings_bak.php.new ;; |
107 |
esac |
108 |
mv -f /opt/SMF/Settings_bak.php.new /opt/SMF/Settings_bak.php |
109 |
chown root:www /opt/SMF/Settings_bak.php |
110 |
chmod 664 /opt/SMF/Settings_bak.php |
111 |
|
112 |
echo "Applying modifications to httpd..." |
113 |
/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf |
114 |
/etc/rc7.d/S86httpd-e-smith sigusr1 |
115 |
|
116 |
case "$LANG" in |
117 |
de_DE) lang=German ;; |
118 |
es_ES) lang=Spanish ;; |
119 |
fr_FR) lang=French ;; |
120 |
it_IT) lang=Italian ;; |
121 |
sv_FI) lang=Swedish ;; |
122 |
*) lang=English ;; |
123 |
esac |
124 |
echo " " |
125 |
echo "-------------------------------------------------------------------------------" |
126 |
echo "SMF Installation finished." |
127 |
echo "Default forum language is set to $lang." |
128 |
echo "URL of the website : http://$DOMAIN/forum" |
129 |
echo " " |
130 |
echo "Login: admin" |
131 |
echo "Pass : admin" |
132 |
echo "Please change the admin password first!" |
133 |
echo " " |
134 |
/sbin/e-smith/config show SMF |
135 |
echo "-------------------------------------------------------------------------------" |
136 |
|
137 |
%preun |
138 |
|
139 |
%postun |
140 |
echo "Restarting Apache..." |
141 |
/sbin/e-smith/expand-template etc/httpd/conf/httpd.conf |
142 |
/etc/rc7.d/S86httpd-e-smith sigusr1 |
143 |
|
144 |
echo "Deleting MySQL user and DataBase..." |
145 |
mysql -u root -e "DROP DATABASE smf" |
146 |
mysql -u root -e "REVOKE ALL PRIVILEGES ON smf.* FROM 'smf'@'localhost';" |
147 |
mysql -u root -e "DROP USER smf@localhost;" |
148 |
/sbin/e-smith/config delete SMF |
149 |
|
150 |
echo "Removing install directory..." |
151 |
rm -rf /opt/SMF |