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