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