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