]> git.pld-linux.org Git - packages/lms.git/blame - lms.spec
- release 10 (by relup.sh)
[packages/lms.git] / lms.spec
CommitLineData
64351d7b
TP
1# TODO:
2# - package documents/templates/default
03d9c849 3# - cosmetics (sort in %%files and %%install)
64351d7b 4# - consider contrib and samples (re)packaging
273010b2 5#
6# Conditional build:
a072064c 7%bcond_without lmsd # without lmsd daemon
fe902a4b 8%bcond_with lmsd_debug # with lmsd debugging
953ccfa8 9
aef69fa8 10%define lmsver 1.11
8b501fcf 11%define lmssubver 13
22909130 12Summary: LAN Managment System
2359e96f 13Summary(pl.UTF-8): System Zarządzania Siecią Lokalną
22909130 14Name: lms
273010b2 15Version: %{lmsver}.%{lmssubver}
b0da852f 16Release: 10
ab4f73d4 17License: GPL v2
22909130 18Group: Networking/Utilities
8670b6bc 19Source0: http://www.lms.org.pl/download/%{lmsver}/%{name}-%{version}.tar.gz
8b501fcf 20# Source0-md5: 294899358ae2585a4030580d79a06ee8
885f795c
JR
21Source1: %{name}.init
22Source2: %{name}.sysconfig
23Source3: %{name}-apache.conf
24Source4: %{name}-httpd.conf
46d522a5 25Patch0: %{name}-PLD.patch
273010b2 26Patch1: %{name}-amd64.patch
a1016496 27Patch2: %{name}-smarty.patch
c66e68d7 28Patch3: build.patch
864db7d0 29URL: http://www.lms.org.pl/
a1016496
ER
30BuildRequires: bison
31BuildRequires: flex
a072064c 32%{?with_lmsd:BuildRequires: libgadu-devel}
33%{?with_lmsd:BuildRequires: mysql-devel}
ac37211c 34BuildRequires: net-snmp-devel
aa4cb6ed 35%{?with_lmsd:BuildRequires: postgresql-devel >= 8.2}
a1016496 36BuildRequires: rpm-pythonprov
495cdf06 37BuildRequires: rpmbuild(macros) >= 1.461
ac37211c 38BuildRequires: yacc
a072064c 39%{?with_lmsd:Requires(post,preun): /sbin/chkconfig}
8670b6bc 40Requires: Smarty >= 2.6.18-2
a335e4ed
ER
41Requires: php(gd)
42Requires: php(iconv)
ddd97afb
SP
43Requires: php(mbstring)
44Requires: php(mysql)
a335e4ed
ER
45Requires: php(pcre)
46Requires: php(posix)
3674e9e4 47Requires: webapps
beed63b5
SP
48Requires: webserver(access)
49Requires: webserver(alias)
a335e4ed 50Requires: webserver(php)
885f795c 51Conflicts: apache-base < 2.4.0-1
22909130 52BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
53
273010b2 54%define _sysconfdir /etc/%{name}
3674e9e4
ER
55%define _webapps /etc/webapps
56%define _webapp %{name}
64351d7b
TP
57%define _smartyplugindir %{php_data_dir}/Smarty/plugins
58%define _lmsdir %{_datadir}/%{name}
59%define _lmsvar /var/lib/%{name}
22909130 60
61%description
903f9044 62This is a package of applications in PHP and Perl for managing LANs.
273010b2 63It's using MySQL or PostgreSQL. The main goal is to get the best
888faf4b 64service of users at provider's level. The main features in LMS are:
03d9c849 65- database of users (name, surname, address, telephone number,
64351d7b
TP
66 commentary),
67- database of computers (IP, MAC),
68- easy-ridden financial system and funds of network,
69- different subscriptions,
70- sending warnings to users,
71- many levels of access for LMS administrators,
2dfa4d4f 72- autogenerating ipchains, iptables, dhcpd, ethers file, oidentd,
64351d7b 73 openbsd packet filter configuration files/scripts,
90b91a27 74- autogenerating almost any kind of config file using templates.
22909130 75
62e7c272
JR
76%description -l pl.UTF-8
77"LMS" jest skrótem od "LAN Management System". Jest to zestaw
78aplikacji w PHP i Perlu, ułatwiających zarządzanie sieciami
57c06cb1 79osiedlowymi (popularnie zwanymi Amatorskimi Sieciami Komputerowymi),
62e7c272
JR
80opartych o bazę danych MySQL lub PostgreSQL. Główne założenia to
81uzyskanie jakości usług oraz obsługi użytkowników na poziomie
888faf4b 82providera z prawdziwego zdarzenia. Najbardziej podstawowe cechy LMS
83to:
62e7c272 84- baza danych użytkowników (imię, nazwisko, adres, numer telefonu,
64351d7b
TP
85 uwagi),
86- baza danych komputerów (adres IP, adres MAC),
57c06cb1 87- prowadzenie prostego rachunku operacji finansowych oraz stanu
64351d7b
TP
88 funduszów sieci,
89- różne taryfy abonamentowe,
90- wysyłanie pocztą elektroniczną upomnień do użytkowników,
91- automatyczne naliczanie opłat miesięcznych,
92- różne poziomy dostępu do funkcji LMS dla administratorów,
62e7c272 93- generowanie reguł i plików konfiguracyjnych dla ipchains, iptables,
64351d7b 94 dhcpd, oidentd, packet filtra openbsd, wpisów /etc/ethers,
62e7c272
JR
95- generowanie praktycznie każdego pliku konfiguracyjnego na podstawie
96 danych w bazie przy użyciu prostych szablonów.
22909130 97
c339c515
ŁJM
98%package scripts
99Summary: LAN Managment System - scripts
2359e96f 100Summary(pl.UTF-8): LAN Managment System - skrypty
273010b2 101Group: Networking/Utilities
c339c515
ŁJM
102Requires: perl-Config-IniFiles
103Requires: perl-DBI
1e7c8904 104Requires: perl-Net-SMTP-Server
c339c515
ŁJM
105
106%description scripts
342af906
JB
107This package contains scripts to integrate LMS with your system,
108monthly billing, notify users about their debts and cutting off
03d9c849 109customers. Also you can build probably any kind of config file using
342af906 110lms-mgc.
c339c515 111
62e7c272 112%description scripts -l pl.UTF-8
342af906 113Ten pakiet zawiera skrypty do zintegrowania LMS z systemem, naliczania
62e7c272
JR
114comiesięcznych opłat, powiadamiania użytkowników o ich zadłużeniu oraz
115ich automagicznego odłączania. Możesz także zbudować prawdopodobnie
116każdy typ pliku konfiguracyjnego przy użyciu lms-mgc.
c339c515 117
273010b2 118%package sqlpanel
119Summary: LAN Managment System - sqlpanel module
2359e96f 120Summary(pl.UTF-8): LAN Managment System - moduł sqlpanel
273010b2 121Group: Networking/Utilities
d0c1a05f 122Requires: %{name} = %{version}-%{release}
273010b2 123
124%description sqlpanel
125SQL-panel module allows you to execute SQL queries and directly modify
126data.
127
62e7c272
JR
128%description sqlpanel -l pl.UTF-8
129Moduł 'SQL - panel' daje możliwość bezpośredniego dostępu do bazy
130danych poprzez zadawanie zapytań SQL. Wyniki wyświetlane są w formie
273010b2 131tabeli. Ponadto podawany jest czas wykonania zapytania.
132
133%package user
134Summary: LAN Managment System - simple user interface
2359e96f 135Summary(pl.UTF-8): LAN Managment System - prosty interfejs użytkownika
273010b2 136Group: Networking/Utilities
d0c1a05f 137Requires: %{name} = %{version}-%{release}
273010b2 138
139%description user
140Simple user interface.
141
62e7c272
JR
142%description user -l pl.UTF-8
143Prosty interfejs użytkownika.
273010b2 144
a072064c 145%package lmsd
efde61fc 146Summary: LAN Managment System - LMS system backend
2359e96f 147Summary(pl.UTF-8): LAN Managment System - backend systemu LMS
273010b2 148Group: Networking/Utilities
f856e948
JB
149Requires(post,preun): /sbin/chkconfig
150Requires: rc-scripts
09a5ca2d 151Obsoletes: lms-almsd
273010b2 152
a072064c 153%description lmsd
d0c1a05f
JB
154A program to manage the server by creating configuration files based
155upon LMS database and restarting selected services.
273010b2 156
62e7c272
JR
157%description lmsd -l pl.UTF-8
158Program zarządzający serwerem poprzez tworzenie plików
f856e948 159konfiguracyjnych na podstawie bazy danych LMS-a i restartowanie
62e7c272 160wybranych usług.
9603d008 161
5a4bc3c7 162%package userpanel
aa4cb6ed
SP
163Summary: LAN Managment System - Userpanel
164Summary(pl.UTF-8): System Zarządzania Siecią Lokalną - Panel Użytkownika
165Group: Networking/Utilities
166Requires: %{name} = %{version}-%{release}
5a4bc3c7
GP
167
168%description userpanel
169Userpanel is automated virtual customer service, based on LMS and
170using its core features. It enables customers (or it's intended to) to
171do review their payments, change their personal details or computer
172properties, modify subscriptions, submit problems, track their
173requests on Helpdesk and print invoices. It means, it makes a closer
174contact with their ISP.
175
176%description userpanel -l pl.UTF-8
177Userpanel jest opartą na szkielecie LMS (i ściśle z LMS
178współpracującą) implementacją tzw. e-boku. Umożliwia (albo będzie
179umożliwiał) klientom przeglądanie stanu swoich wpłat, zmianę swoich
180danych osobowych, edycję właściwości swoich komputerów, zmianę taryf,
181zgłaszanie błędów oraz awarii do Helpdesku, wydruk faktur oraz
182formularza przelewu.
183
22909130 184%prep
342af906 185%setup -q -n %{name}
3d829255 186%patch0 -p1
c7b20370 187%if "%{_lib}" == "lib64"
273010b2 188%patch1 -p1
189%endif
5e115572 190%patch2 -p1
c66e68d7 191%patch3 -p1
273010b2 192
a1016496 193mkdir smarty-plugins
64351d7b
TP
194%{__mv} \
195 lib/Smarty/plugins/block.t.php \
196 lib/Smarty/plugins/function.{bankaccount,gentime,handle,memory,number,size,sum,tip}.php \
197 lib/Smarty/plugins/modifier.{money_format,striphtml,to_words}.php \
a1016496 198 smarty-plugins
64351d7b 199%{__rm} -r lib/Smarty
a1016496 200
953ccfa8 201# cleanup backups after patching
64351d7b 202find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 %{__rm}
953ccfa8 203
273010b2 204%build
a072064c 205%if %{with lmsd}
273010b2 206cd daemon
207
fe902a4b 208./configure --with-mysql %{?with_lmsd_debug:--enable-debug0 --enable-debug1}
273010b2 209%{__make} \
9a9c8fa3
TO
210 CC='%{__cc}' \
211 CFLAGS='%{rpmcflags} -fPIC -DUSE_MYSQL -DLMS_LIB_DIR=\"%{_libdir}/lms/\" -I../..'
a072064c 212mv lmsd lmsd-mysql
273010b2 213
fe902a4b 214./configure --with-pgsql %{?with_lmsd_debug:--enable-debug0 --enable-debug1}
a072064c 215%{__make} lmsd \
273010b2 216 CC='%{__cc}' \
03d9c849 217 CFLAGS='%{rpmcflags} -fPIC -DUSE_PGSQL -DLMS_LIB_DIR=\"%{_libdir}/lms/\" -I../..'
a072064c 218mv lmsd lmsd-pgsql
273010b2 219
a1c1a4be
TP
220CFLAGS="%{rpmcflags}" %{__make} -j1 -C modules/parser \
221 CC='%{__cc}'
64351d7b 222
273010b2 223cd ..
224%endif
22909130 225
226%install
227rm -rf $RPM_BUILD_ROOT
64351d7b 228install -d $RPM_BUILD_ROOT{%{_sbindir},%{_libdir}/%{name},%{_webapps}/%{_webapp}} \
183a276d 229 $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig,lms/modules} \
64351d7b
TP
230 $RPM_BUILD_ROOT%{_smartyplugindir} \
231 $RPM_BUILD_ROOT%{_lmsdir}/{lms,userpanel,www/{doc,user,userpanel/modules}} \
232 $RPM_BUILD_ROOT%{_lmsvar}/{backups,documents,templates_c,userpanel/templates_c}
233
234cp -a *.php img $RPM_BUILD_ROOT%{_lmsdir}/www
a1016496 235cp -a doc/html $RPM_BUILD_ROOT%{_lmsdir}/www/doc
64351d7b 236cp -a contrib lib modules sample templates $RPM_BUILD_ROOT%{_lmsdir}
a1016496 237cp -a smarty-plugins/* $RPM_BUILD_ROOT%{_smartyplugindir}
64351d7b 238cp -a bin/* $RPM_BUILD_ROOT%{_sbindir}
273010b2 239
64351d7b 240%{__mv} $RPM_BUILD_ROOT{%{_lmsdir}/sample/%{name}.ini,%{_sysconfdir}}
3674e9e4 241
885f795c
JR
242install %{SOURCE3} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
243install %{SOURCE4} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
273010b2 244
245# sqlpanel
64351d7b
TP
246%{__mv} $RPM_BUILD_ROOT%{_lmsdir}/{contrib/sqlpanel/sql*.php,modules}
247%{__mv} $RPM_BUILD_ROOT%{_lmsdir}/{contrib/sqlpanel/*.html,templates}
273010b2 248
249# user
64351d7b 250%{__mv} $RPM_BUILD_ROOT%{_lmsdir}/{contrib/customer/*,www/user}
273010b2 251
252# daemon
a072064c 253%if %{with lmsd}
64351d7b
TP
254install daemon/lmsd-*sql $RPM_BUILD_ROOT%{_sbindir}
255install daemon/modules/*/*.so $RPM_BUILD_ROOT%{_libdir}/%{name}
256for module in dns ggnotify notify; do
257 cp -a daemon/modules/$module/sample $RPM_BUILD_ROOT%{_sysconfdir}/modules/$module
258done
885f795c
JR
259install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/lmsd
260install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
273010b2 261%endif
22909130 262
5a4bc3c7 263#userpanel
64351d7b
TP
264cp -a userpanel/{lib,modules,templates} $RPM_BUILD_ROOT%{_lmsdir}/userpanel
265cp -a userpanel/{index.php,style} $RPM_BUILD_ROOT%{_lmsdir}/www/userpanel
266ln -s %{_lmsdir}/www/userpanel/style $RPM_BUILD_ROOT%{_lmsdir}/userpanel
267ln -s %{_lmsvar}/userpanel/templates_c $RPM_BUILD_ROOT%{_lmsdir}/userpanel
5a4bc3c7
GP
268
269for MODULE in $RPM_BUILD_ROOT%{_lmsdir}/userpanel/modules/*; do
64351d7b
TP
270 MODULE=$(basename $MODULE)
271 mkdir $RPM_BUILD_ROOT%{_lmsdir}/www/userpanel/modules/$MODULE
272 ln -s %{_lmsdir}/userpanel/modules/$MODULE/style \
273 $RPM_BUILD_ROOT%{_lmsdir}/www/userpanel/modules/$MODULE
5a4bc3c7
GP
274done
275
22909130 276%clean
277rm -rf $RPM_BUILD_ROOT
278
a072064c 279%post lmsd
273010b2 280/sbin/chkconfig --add lmsd
d5c71495 281%service lmsd restart "lmsd daemon"
273010b2 282
a072064c 283%preun lmsd
273010b2 284if [ "$1" = "0" ]; then
d5c71495 285 %service lmsd stop
273010b2 286 /sbin/chkconfig --del lmsd
287fi
288
3d0148ce 289%triggerin -- apache1 < 1.3.37-3, apache1-base
3674e9e4
ER
290%webapp_register apache %{_webapp}
291
3d0148ce 292%triggerun -- apache1 < 1.3.37-3, apache1-base
3674e9e4
ER
293%webapp_unregister apache %{_webapp}
294
885f795c 295%triggerin -- apache-base
3674e9e4
ER
296%webapp_register httpd %{_webapp}
297
885f795c 298%triggerun -- apache-base
3674e9e4
ER
299%webapp_unregister httpd %{_webapp}
300
22909130 301%files
302%defattr(644,root,root,755)
ab4f73d4 303%doc doc/{AUTHORS,ChangeLog,INSTALL,README*,lms*}
273010b2 304%dir %{_sysconfdir}
1e7c8904 305%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*.ini
3674e9e4
ER
306%dir %attr(750,root,http) %{_webapps}/%{_webapp}
307%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
308%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
64351d7b 309%{_smartyplugindir}/*.php
273010b2 310#
311%dir %{_lmsvar}
312%attr(770,root,http) %{_lmsvar}/backups
726bd551 313%attr(770,root,http) %{_lmsvar}/documents
64351d7b 314%attr(770,root,http) %{_lmsvar}/templates_c
273010b2 315#
22909130 316%dir %{_lmsdir}
273010b2 317%{_lmsdir}/lib
318%{_lmsdir}/modules
319%exclude %{_lmsdir}/modules/sql.php
64351d7b
TP
320%exclude %{_lmsdir}/modules/sqllang.php
321%{_lmsdir}/templates
322%exclude %{_lmsdir}/templates/sql.html
323%exclude %{_lmsdir}/templates/sqlprint.html
324%{_lmsdir}/www
325%exclude %{_lmsdir}/www/user
326%exclude %{_lmsdir}/www/userpanel
273010b2 327%{_lmsdir}/contrib
aed1f328
ER
328%dir %{_lmsdir}/sample
329%{_lmsdir}/sample/crontab-entry
64351d7b
TP
330%{_lmsdir}/sample/lms-mgc*.ini
331%{_lmsdir}/sample/*.conf
332%{_lmsdir}/sample/*.txt
aed1f328
ER
333%{_lmsdir}/sample/rc.lmsd
334%{_lmsdir}/sample/rc.reminder_1st
b4677ec9 335%attr(755,root,root) %{_lmsdir}/sample/traffic_ipt.pl
aed1f328 336
c339c515 337%files scripts
342af906 338%defattr(644,root,root,755)
64351d7b 339%attr(755,root,root) %{_sbindir}/lms-*
273010b2 340
341%files sqlpanel
342%defattr(644,root,root,755)
343%{_lmsdir}/modules/sql.php
64351d7b 344%{_lmsdir}/modules/sqllang.php
273010b2 345%{_lmsdir}/templates/sql.html
346%{_lmsdir}/templates/sqlprint.html
347
348%files user
349%defattr(644,root,root,755)
350%{_lmsdir}/www/user
351
a072064c 352%if %{with lmsd}
353%files lmsd
273010b2 354%defattr(644,root,root,755)
b0f05b97 355%attr(755,root,root) %{_sbindir}/lmsd-*sql
f856e948
JB
356%dir %{_libdir}/lms
357%attr(755,root,root) %{_libdir}/lms/*.so
273010b2 358%attr(754,root,root) /etc/rc.d/init.d/lmsd
f856e948
JB
359# XXX: dir shared with base
360%dir %{_sysconfdir}
361%dir %{_sysconfdir}/modules
362%{_sysconfdir}/modules/*
273010b2 363%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
364%endif
5a4bc3c7
GP
365
366%files userpanel
367%defattr(644,root,root,755)
368%dir %{_lmsdir}/userpanel
369%{_lmsdir}/userpanel/lib
370%{_lmsdir}/userpanel/modules
371%{_lmsdir}/userpanel/templates
372%{_lmsdir}/userpanel/templates_c
373%{_lmsdir}/userpanel/style
374%dir %{_lmsdir}/www/userpanel
375%{_lmsdir}/www/userpanel/style
376%{_lmsdir}/www/userpanel/index.php
377%dir %{_lmsvar}/userpanel
a937c8d2 378%attr(770,root,http) %{_lmsvar}/userpanel/templates_c
This page took 0.115109 seconds and 4 git commands to generate.