]>
Commit | Line | Data |
---|---|---|
1 | # TODO | |
2 | # - test build on amd64 and check /usr/lib64 patch | |
3 | # - cosmetics (sort in %%files and %%install) | |
4 | # - contrib split | |
5 | # | |
6 | # Conditional build: | |
7 | %bcond_without lmsd # without lmsd daemon | |
8 | # | |
9 | %define lmsver 1.9 | |
10 | %define lmssubver 5 | |
11 | Summary: LAN Managment System | |
12 | Summary(pl.UTF-8): System Zarządzania Siecią Lokalną | |
13 | Name: lms | |
14 | Version: %{lmsver}.%{lmssubver} | |
15 | Release: 1 | |
16 | License: GPL v2 | |
17 | Group: Networking/Utilities | |
18 | Source0: http://lms.org.pl/download/%{lmsver}/%{name}-%{version}.tar.gz | |
19 | # Source0-md5: f3d0284b3f2028ba74d2b8c3f52897cb | |
20 | Source1: %{name}.conf | |
21 | Source2: %{name}.init | |
22 | Source3: %{name}.sysconfig | |
23 | Patch0: %{name}-PLD.patch | |
24 | Patch1: %{name}-amd64.patch | |
25 | Patch2: %{name}-smarty.patch | |
26 | URL: http://lms.org.pl/ | |
27 | BuildRequires: bison | |
28 | BuildRequires: flex | |
29 | %{?with_lmsd:BuildRequires: libgadu-devel} | |
30 | %{?with_lmsd:BuildRequires: mysql-devel} | |
31 | %{?with_lmsd:BuildRequires: postgresql-devel} | |
32 | BuildRequires: rpm-pythonprov | |
33 | BuildRequires: rpmbuild(macros) >= 1.268 | |
34 | %{?with_lmsd:Requires(post,preun): /sbin/chkconfig} | |
35 | Requires: Smarty >= 2.6.10-4 | |
36 | Requires: php(gd) | |
37 | Requires: php(iconv) | |
38 | Requires: php(pcre) | |
39 | Requires: php(posix) | |
40 | Requires: webapps | |
41 | Requires: webserver(php) | |
42 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
43 | ||
44 | %define _sysconfdir /etc/%{name} | |
45 | %define _lmsdir %{_datadir}/%{name} | |
46 | %define _lmsvar /var/lib/%{name} | |
47 | %define _smartyplugindir /usr/share/php/Smarty/plugins | |
48 | %define _webapps /etc/webapps | |
49 | %define _webapp %{name} | |
50 | ||
51 | %description | |
52 | This is a package of applications in PHP and Perl for managing LANs. | |
53 | It's using MySQL or PostgreSQL. The main goal is to get the best | |
54 | service of users at provider's level. The main features in LMS are: | |
55 | - database of users (name, surname, address, telephone number, | |
56 | commentary); | |
57 | - database of computers (IP, MAC); | |
58 | - easy-ridden financial system and funds of network; | |
59 | - different subscriptions; | |
60 | - sending warnings to users; | |
61 | - many levels of access for LMS administrators; | |
62 | - autogenerating ipchains, iptables, dhcpd, ethers file, oidentd, | |
63 | openbsd packet filter configuration files/scripts; | |
64 | - autogenerating almost any kind of config file using templates. | |
65 | ||
66 | %description -l pl.UTF-8 | |
67 | "LMS" jest skrótem od "LAN Management System". Jest to zestaw | |
68 | aplikacji w PHP i Perlu, ułatwiających zarządzanie sieciami | |
69 | osiedlowymi (popularnie zwanymi Amatorskimi Sieciami Komputerowymi), | |
70 | opartych o bazę danych MySQL lub PostgreSQL. Główne założenia to | |
71 | uzyskanie jakości usług oraz obsługi użytkowników na poziomie | |
72 | providera z prawdziwego zdarzenia. Najbardziej podstawowe cechy LMS | |
73 | to: | |
74 | - baza danych użytkowników (imię, nazwisko, adres, numer telefonu, | |
75 | uwagi); | |
76 | - baza danych komputerów (adres IP, adres MAC); | |
77 | - prowadzenie prostego rachunku operacji finansowych oraz stanu | |
78 | funduszów sieci; | |
79 | - różne taryfy abonamentowe; | |
80 | - wysyłanie pocztą elektroniczną upomnień do użytkowników; | |
81 | - automatyczne naliczanie opłat miesięcznych; | |
82 | - różne poziomy dostępu do funkcji LMS dla administratorów; | |
83 | - generowanie reguł i plików konfiguracyjnych dla ipchains, iptables, | |
84 | dhcpd, oidentd, packet filtra openbsd, wpisów /etc/ethers | |
85 | - generowanie praktycznie każdego pliku konfiguracyjnego na podstawie | |
86 | danych w bazie przy użyciu prostych szablonów. | |
87 | ||
88 | %package scripts | |
89 | Summary: LAN Managment System - scripts | |
90 | Summary(pl.UTF-8): LAN Managment System - skrypty | |
91 | Group: Networking/Utilities | |
92 | Requires: perl-Config-IniFiles | |
93 | Requires: perl-DBI | |
94 | Requires: perl-Net-SMTP-Server | |
95 | ||
96 | %description scripts | |
97 | This package contains scripts to integrate LMS with your system, | |
98 | monthly billing, notify users about their debts and cutting off | |
99 | customers. Also you can build probably any kind of config file using | |
100 | lms-mgc. | |
101 | ||
102 | %description scripts -l pl.UTF-8 | |
103 | Ten pakiet zawiera skrypty do zintegrowania LMS z systemem, naliczania | |
104 | comiesięcznych opłat, powiadamiania użytkowników o ich zadłużeniu oraz | |
105 | ich automagicznego odłączania. Możesz także zbudować prawdopodobnie | |
106 | każdy typ pliku konfiguracyjnego przy użyciu lms-mgc. | |
107 | ||
108 | %package sqlpanel | |
109 | Summary: LAN Managment System - sqlpanel module | |
110 | Summary(pl.UTF-8): LAN Managment System - moduł sqlpanel | |
111 | Group: Networking/Utilities | |
112 | Requires: %{name} = %{version}-%{release} | |
113 | ||
114 | %description sqlpanel | |
115 | SQL-panel module allows you to execute SQL queries and directly modify | |
116 | data. | |
117 | ||
118 | %description sqlpanel -l pl.UTF-8 | |
119 | Moduł 'SQL - panel' daje możliwość bezpośredniego dostępu do bazy | |
120 | danych poprzez zadawanie zapytań SQL. Wyniki wyświetlane są w formie | |
121 | tabeli. Ponadto podawany jest czas wykonania zapytania. | |
122 | ||
123 | %package user | |
124 | Summary: LAN Managment System - simple user interface | |
125 | Summary(pl.UTF-8): LAN Managment System - prosty interfejs użytkownika | |
126 | Group: Networking/Utilities | |
127 | Requires: %{name} = %{version}-%{release} | |
128 | ||
129 | %description user | |
130 | Simple user interface. | |
131 | ||
132 | %description user -l pl.UTF-8 | |
133 | Prosty interfejs użytkownika. | |
134 | ||
135 | %package lmsd | |
136 | Summary: LAN Managment System - LMS system backend | |
137 | Summary(pl.UTF-8): LAN Managment System - backend systemu LMS | |
138 | Group: Networking/Utilities | |
139 | Requires(post,preun): /sbin/chkconfig | |
140 | Requires: rc-scripts | |
141 | Obsoletes: lms-almsd | |
142 | ||
143 | %description lmsd | |
144 | A program to manage the server by creating configuration files based | |
145 | upon LMS database and restarting selected services. | |
146 | ||
147 | %description lmsd -l pl.UTF-8 | |
148 | Program zarządzający serwerem poprzez tworzenie plików | |
149 | konfiguracyjnych na podstawie bazy danych LMS-a i restartowanie | |
150 | wybranych usług. | |
151 | ||
152 | %prep | |
153 | %setup -q -n %{name} | |
154 | %patch0 -p1 | |
155 | %if "%{_lib}" == "lib64" | |
156 | %patch1 -p1 | |
157 | %endif | |
158 | ||
159 | mkdir smarty-plugins | |
160 | mv \ | |
161 | lib/Smarty/plugins/block.t.php \ | |
162 | lib/Smarty/plugins/function.{bankaccount,handle,number,size,sum,tip}.php \ | |
163 | lib/Smarty/plugins/modifier.{money_format,striphtml,to_words}.php \ | |
164 | smarty-plugins | |
165 | rm -rf lib/Smarty | |
166 | ||
167 | %build | |
168 | %if %{with lmsd} | |
169 | ||
170 | cd daemon | |
171 | ||
172 | ./configure --with-mysql | |
173 | %{__make} \ | |
174 | CC='%{__cc}' \ | |
175 | CFLAGS='%{rpmcflags} -fPIC -DUSE_MYSQL -DLMS_LIB_DIR=\"%{_libdir}/lms/\" -I../..' | |
176 | mv lmsd lmsd-mysql | |
177 | ||
178 | ./configure --with-pgsql | |
179 | %{__make} lmsd \ | |
180 | CC='%{__cc}' \ | |
181 | CFLAGS='%{rpmcflags} -fPIC -DUSE_PGSQL -DLMS_LIB_DIR=\"%{_libdir}/lms/\" -I../..' | |
182 | mv lmsd lmsd-pgsql | |
183 | ||
184 | cd .. | |
185 | %endif | |
186 | ||
187 | %install | |
188 | rm -rf $RPM_BUILD_ROOT | |
189 | install -d $RPM_BUILD_ROOT%{_sbindir} \ | |
190 | $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig} \ | |
191 | $RPM_BUILD_ROOT/etc/lms/modules/{dns,ggnofity,nofity} \ | |
192 | $RPM_BUILD_ROOT{%{_lmsvar}/{backups,templates_c,documents},%{_libdir}/lms} \ | |
193 | $RPM_BUILD_ROOT%{_lmsdir}/www/{img,doc,user} \ | |
194 | $RPM_BUILD_ROOT%{_lmsdir}/www/img/core \ | |
195 | $RPM_BUILD_ROOT%{_smartyplugindir} | |
196 | ||
197 | install *.php $RPM_BUILD_ROOT%{_lmsdir}/www | |
198 | install img/core/* $RPM_BUILD_ROOT%{_lmsdir}/www/img/core/* | |
199 | install img/*.gif $RPM_BUILD_ROOT%{_lmsdir}/www/img | |
200 | install img/*.jpg $RPM_BUILD_ROOT%{_lmsdir}/www/img | |
201 | install img/*.png $RPM_BUILD_ROOT%{_lmsdir}/www/img | |
202 | install img/*.css $RPM_BUILD_ROOT%{_lmsdir}/www/img | |
203 | install img/*.js $RPM_BUILD_ROOT%{_lmsdir}/www/img | |
204 | install img/*.fdb $RPM_BUILD_ROOT%{_lmsdir}/www/img | |
205 | cp -a doc/html $RPM_BUILD_ROOT%{_lmsdir}/www/doc | |
206 | cp -a lib contrib modules templates sample $RPM_BUILD_ROOT%{_lmsdir} | |
207 | install bin/* $RPM_BUILD_ROOT%{_sbindir} | |
208 | cp -a smarty-plugins/* $RPM_BUILD_ROOT%{_smartyplugindir} | |
209 | ||
210 | install sample/%{name}.ini $RPM_BUILD_ROOT%{_sysconfdir} | |
211 | ||
212 | install -d $RPM_BUILD_ROOT%{_webapps}/%{_webapp} | |
213 | install %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf | |
214 | install %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf | |
215 | ||
216 | # sqlpanel | |
217 | install contrib/sqlpanel/sql.php $RPM_BUILD_ROOT%{_lmsdir}/modules | |
218 | install contrib/sqlpanel/*.html $RPM_BUILD_ROOT%{_lmsdir}/templates | |
219 | ||
220 | # user | |
221 | cp -r contrib/customer/* $RPM_BUILD_ROOT%{_lmsdir}/www/user | |
222 | ||
223 | # daemon | |
224 | %if %{with lmsd} | |
225 | install daemon/lmsd-* $RPM_BUILD_ROOT%{_sbindir} | |
226 | install daemon/modules/*/*.so $RPM_BUILD_ROOT%{_libdir}/lms | |
227 | cp -r daemon/modules/dns/sample $RPM_BUILD_ROOT%{_sysconfdir}/modules/dns | |
228 | cp -r daemon/modules/ggnotify/sample $RPM_BUILD_ROOT%{_sysconfdir}/modules/ggnotify | |
229 | cp -r daemon/modules/dns/sample $RPM_BUILD_ROOT%{_sysconfdir}/modules/nofity | |
230 | install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/lmsd | |
231 | install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name} | |
232 | %endif | |
233 | ||
234 | %clean | |
235 | rm -rf $RPM_BUILD_ROOT | |
236 | ||
237 | %post lmsd | |
238 | /sbin/chkconfig --add lmsd | |
239 | %service lmsd restart "lmsd daemon" | |
240 | ||
241 | %preun lmsd | |
242 | if [ "$1" = "0" ]; then | |
243 | %service lmsd stop | |
244 | /sbin/chkconfig --del lmsd | |
245 | fi | |
246 | ||
247 | %triggerin -- apache1 < 1.3.37-3, apache1-base | |
248 | %webapp_register apache %{_webapp} | |
249 | ||
250 | %triggerun -- apache1 < 1.3.37-3, apache1-base | |
251 | %webapp_unregister apache %{_webapp} | |
252 | ||
253 | %triggerin -- apache < 2.2.0, apache-base | |
254 | %webapp_register httpd %{_webapp} | |
255 | ||
256 | %triggerun -- apache < 2.2.0, apache-base | |
257 | %webapp_unregister httpd %{_webapp} | |
258 | ||
259 | %triggerpostun -- %{name} <= 1.0.4 | |
260 | echo "WARNING!!!" | |
261 | echo "_READ_ and upgrade LMS database:" | |
262 | echo "MySQL: /usr/share/doc/%{name}-%{version}/UPGRADE-1.0-1.5.mysql.gz" | |
263 | echo "PostgreSQL: /usr/share/doc/%{name}-%{version}/UPGRADE-1.0-1.5.pgsql.gz" | |
264 | ||
265 | %triggerpostun -- %{name} <= 1.2.0 | |
266 | echo "BEWARE:" | |
267 | echo "Automatic upgrade from LMS<= 1.2.0 is NO LONGER SUPPORTED by lms team" | |
268 | echo "You are advised to upgrade it manually" | |
269 | echo | |
270 | ||
271 | %triggerpostun -- %{name} < 1.6.6-1.4 | |
272 | # nuke very-old config location (this mostly for Ra) | |
273 | if [ -f /etc/httpd/httpd.conf ]; then | |
274 | sed -i -e "/^Include.*%{name}.conf/d" /etc/httpd/httpd.conf | |
275 | fi | |
276 | ||
277 | # migrate from httpd (apache2) config dir | |
278 | if [ -f /etc/httpd/%{name}.conf.rpmsave ]; then | |
279 | cp -f %{_webapps}/%{_webapp}/httpd.conf{,.rpmnew} | |
280 | mv -f /etc/httpd/%{name}.conf.rpmsave %{_webapps}/%{_webapp}/httpd.conf | |
281 | fi | |
282 | ||
283 | rm -f /etc/httpd/httpd.conf/99_%{name}.conf | |
284 | /usr/sbin/webapp register httpd %{_webapp} | |
285 | %service -q httpd reload | |
286 | ||
287 | %files | |
288 | %defattr(644,root,root,755) | |
289 | %doc doc/{AUTHORS,ChangeLog,INSTALL,README*,lms*} | |
290 | %dir %{_sysconfdir} | |
291 | %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*.ini | |
292 | %dir %attr(750,root,http) %{_webapps}/%{_webapp} | |
293 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf | |
294 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf | |
295 | %{_smartyplugindir}/* | |
296 | # | |
297 | %dir %{_lmsvar} | |
298 | %attr(770,root,http) %{_lmsvar}/backups | |
299 | %attr(770,root,http) %{_lmsvar}/templates_c | |
300 | %attr(770,root,http) %{_lmsvar}/documents | |
301 | # | |
302 | %dir %{_lmsdir} | |
303 | %{_lmsdir}/www | |
304 | %exclude %{_lmsdir}/www/user | |
305 | %{_lmsdir}/lib | |
306 | %{_lmsdir}/modules | |
307 | %exclude %{_lmsdir}/modules/sql.php | |
308 | %{_lmsdir}/contrib | |
309 | %dir %{_lmsdir}/sample | |
310 | %{_lmsdir}/sample/crontab-entry | |
311 | %{_lmsdir}/sample/lms-mgc-netx-sample.ini | |
312 | %{_lmsdir}/sample/lms-mgc.ini | |
313 | %{_lmsdir}/sample/lms.apache.conf | |
314 | %{_lmsdir}/sample/lms.ini | |
315 | %{_lmsdir}/sample/mailtemplate.txt | |
316 | %{_lmsdir}/sample/mailtemplate_en.txt | |
317 | %{_lmsdir}/sample/rc.lmsd | |
318 | %{_lmsdir}/sample/rc.reminder_1st | |
319 | %{_lmsdir}/sample/smstemplate.txt | |
320 | %{_lmsdir}/sample/tekst_1.txt | |
321 | %{_lmsdir}/sample/test.txt | |
322 | %attr(755,root,root) %{_lmsdir}/sample/traffic_ipt.pl | |
323 | ||
324 | %{_lmsdir}/templates | |
325 | %exclude %{_lmsdir}/templates/sql.html | |
326 | %exclude %{_lmsdir}/templates/sqlprint.html | |
327 | ||
328 | %files scripts | |
329 | %defattr(644,root,root,755) | |
330 | %attr(755,root,root) %{_sbindir}/* | |
331 | ||
332 | %files sqlpanel | |
333 | %defattr(644,root,root,755) | |
334 | %{_lmsdir}/modules/sql.php | |
335 | %{_lmsdir}/templates/sql.html | |
336 | %{_lmsdir}/templates/sqlprint.html | |
337 | ||
338 | %files user | |
339 | %defattr(644,root,root,755) | |
340 | %{_lmsdir}/www/user | |
341 | ||
342 | %if %{with lmsd} | |
343 | %files lmsd | |
344 | %defattr(644,root,root,755) | |
345 | %attr(755,root,root) %{_sbindir}/lmsd-* | |
346 | %dir %{_libdir}/lms | |
347 | %attr(755,root,root) %{_libdir}/lms/*.so | |
348 | %attr(754,root,root) /etc/rc.d/init.d/lmsd | |
349 | # XXX: dir shared with base | |
350 | %dir %{_sysconfdir} | |
351 | %dir %{_sysconfdir}/modules | |
352 | %{_sysconfdir}/modules/* | |
353 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name} | |
354 | %endif |