]> git.pld-linux.org Git - packages/lms.git/blob - lms.spec
- updated to 1.4.0
[packages/lms.git] / lms.spec
1 #
2 # Conditional build:
3 %bcond_without  almsd           # without almsd daemon
4 #
5 # TODO:
6 # - almsd description
7 # - cosmetics (sort in %%files and %%install)
8 # - contrib split
9 %define         lmsver          1.4
10 %define         lmssubver       0
11 Summary:        LAN Managment System
12 Summary(pl):    System Zarz±dzania Sieci± Lokaln±
13 Name:           lms
14 Version:        %{lmsver}.%{lmssubver}
15 Release:        0.1
16 License:        GPL
17 Vendor:         LMS Developers
18 Group:          Networking/Utilities
19 Source0:        http://lms.rulez.pl/download/%{lmsver}/%{name}-%{version}.tar.gz
20 # Source0-md5:  e43e0aa0dacaed71987839c7da3dd7d8
21 Source1:        %{name}.conf
22 Source2:        %{name}.init
23 Source3:        %{name}.sysconfig
24 Patch0:         %{name}-PLD.patch
25 Patch1:         %{name}-amd64.patch
26 URL:            http://lms.rulez.pl/
27 %{?with_almsd:BuildRequires:    libgadu-devel}
28 %{?with_almsd:BuildRequires:    mysql-devel}
29 %{?with_almsd:BuildRequires:    postgresql-devel}
30 %{?with_almsd:PreReq:           rc-scripts}
31 %{?with_almsd:Requires(post,preun):     /sbin/chkconfig}
32 Requires:       php
33 Requires:       php-gd
34 Requires:       php-posix
35 Requires:       php-pcre
36 Requires:       webserver
37 Requires:       Smarty >= 2.5.0
38 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
39
40 %define         _sysconfdir     /etc/%{name}
41 %define         _lmsdir         %{_datadir}/%{name}
42 %define         _lmsvar         /var/lib/%{name}
43
44 %description
45 This is a package of applications in PHP and Perl for managing LANs.
46 It's using MySQL or PostgreSQL. The main goal is to get the best
47 service of users at provider's level. The main features in LMS are:
48 - database of users (name, surname, address, telefon number,
49   commentary);
50 - database of computers (IP, MAC);
51 - easy-ridden financial system and funds of network;
52 - different subscriptions;
53 - sending warnings to users;
54 - many levels of access for LMS administrators;
55 - autogenerating ipchains, iptables, dhcpd, ethers file, oidentd,
56   openbsd packet filter configuration files/scripts;
57 - autogenerating almost any kind of config file using templates;
58
59 %description -l pl
60 "LMS" jest skrótem od "LAN Management System". Jest to zestaw
61 aplikacji w PHP i Perlu, u³atwiaj±cych zarz±dzanie sieciami
62 osiedlowymi (popularnie zwanymi Amatorskimi Sieciami Komputerowymi),
63 opartych o bazê danych MySQL lub PostgreSQL. G³ówne za³o¿enia to
64 uzyskanie jako¶ci us³ug oraz obs³ugi u¿ytkowników na poziomie
65 providera z prawdziwego zdarzenia. Najbardziej podstawowe cechy LMS
66 to:
67 - baza danych u¿ytkowników (imiê, nazwisko, adres, numer telefonu,
68   uwagi);
69 - baza danych komputerów (adres IP, adres MAC);
70 - prowadzenie prostego rachunku operacji finansowych oraz stanu
71   funduszów sieci;
72 - ró¿ne taryfy abonamentowe;
73 - wysy³anie poczt± elektroniczn± upomnieñ do u¿ytkowników;
74 - automatyczne naliczanie op³at miesiêcznych;
75 - ró¿ne poziomy dostêpu do funkcji LMS dla administratorów;
76 - generowanie regu³ i plików konfiguracyjnych dla ipchains, iptables,
77   dhcpd, oidentd, packet filtra openbsd, wpisów /etc/ethers
78 - generowanie praktycznie ka¿dego pliku konfiguracyjnego na podstawie
79   danych w bazie przy u¿yciu prostych szablonów;
80
81 %package scripts
82 Summary:        LAN Managment System - scripts
83 Summary(pl):    LAN Managment System - skrypty
84 Group:          Networking/Utilities
85 Requires:       perl-Net-SMTP-Server
86 Requires:       perl-Config-IniFiles
87 Requires:       perl-DBI
88
89 %description scripts
90 This package contains scripts to integrate LMS with your system,
91 monthly billing, notify users about their debts and cutting off
92 customers. Also you can build propably any kind of config file using
93 lms-mgc.
94
95 %description scripts -l pl
96 Ten pakiet zawiera skrypty do zintegrowania LMS z systemem, naliczania
97 comiesiêcznych op³at, powiadamiania u¿ytkowników o ich zad³u¿eniu oraz
98 ich automagicznego od³±czania. Mo¿esz tak¿e zbudowaæ prawdopodobnie
99 ka¿dy typ pliku konfiguracyjnego przy u¿yciu lms-mgc;
100
101 %package sqlpanel
102 Summary:        LAN Managment System - sqlpanel module
103 Summary(pl):    LAN Managment System - modu³ sqlpanel
104 Group:          Networking/Utilities
105 Requires:       %{name}
106
107 %description sqlpanel
108 SQL-panel module allows you to execute SQL queries and directly modify
109 data.
110
111 %description sqlpanel -l pl
112 Modu³ 'SQL - panel' daje mo¿liwo¶æ bezpo¶redniego dostêpu do bazy
113 danych poprzez zadawanie zapytañ SQL. Wyniki wy¶wietlane s± w formie
114 tabeli. Ponadto podawany jest czas wykonania zapytania.
115
116 %package user
117 Summary:        LAN Managment System - simple user interface
118 Summary(pl):    LAN Managment System - prosty interfejs u¿ytkownika
119 Group:          Networking/Utilities
120 Requires:       %{name}
121
122 %description user
123 Simple user interface.
124
125 %description user -l pl
126 Prosty interfejs u¿ytkownika.
127
128 %package almsd
129 Summary:        LAN Managment System - almsd
130 Group:          Networking/Utilities
131 Requires:       %{name}
132
133 %description almsd
134 TODO
135
136 %prep
137 %setup -q -n %{name}
138 %patch0 -p1
139 %ifarch amd64
140 %patch1 -p1
141 %endif
142
143 %build
144 %if %{with almsd}
145
146 cd daemon
147
148 ./configure --with-mysql
149 %{__make} \
150         CC='%{__cc}' CFLAGS='%{rpmcflags} -fPIC -DUSE_MYSQL -I../..'
151 mv almsd almsd-mysql
152
153 rm db.o
154
155 ./configure --with-pgsql
156 %{__make} almsd \
157         CC='%{__cc}' \
158         CFLAGS='%{rpmcflags} -fPIC -DUSE_PGSQL -I../..'
159 mv almsd almsd-pgsql
160
161 cd ..
162 %endif
163
164 %install
165 rm -rf $RPM_BUILD_ROOT
166 install -d $RPM_BUILD_ROOT%{_sbindir} \
167            $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig,httpd} \
168            $RPM_BUILD_ROOT/etc/lms/modules/{dns,ggnofity,nofity} \
169            $RPM_BUILD_ROOT{%{_lmsvar}/{backups,templates_c},/usr/lib/lms} \
170            $RPM_BUILD_ROOT%{_lmsdir}/www/{img,doc,user}
171
172 install *.php $RPM_BUILD_ROOT%{_lmsdir}/www
173 install img/* $RPM_BUILD_ROOT%{_lmsdir}/www/img
174 cp -r doc/html $RPM_BUILD_ROOT%{_lmsdir}/www/doc
175 cp -r lib contrib modules templates sample $RPM_BUILD_ROOT%{_lmsdir}
176 install bin/* $RPM_BUILD_ROOT%{_sbindir}
177
178 install sample/%{name}.ini $RPM_BUILD_ROOT%{_sysconfdir}
179 install %{SOURCE1} $RPM_BUILD_ROOT/etc/httpd/%{name}.conf
180
181 # sqlpanel
182 install contrib/sqlpanel/sql.php $RPM_BUILD_ROOT%{_lmsdir}/modules
183 install contrib/sqlpanel/*.html $RPM_BUILD_ROOT%{_lmsdir}/templates
184
185 # user
186 install contrib/customer/* $RPM_BUILD_ROOT%{_lmsdir}/www/user
187
188 # daemon
189 %if %{with almsd}
190 install daemon/almsd-* $RPM_BUILD_ROOT%{_sbindir}
191 install daemon/modules/*/*.so $RPM_BUILD_ROOT/usr/lib/lms
192 cp -r daemon/modules/dns/sample $RPM_BUILD_ROOT%{_sysconfdir}/modules/dns
193 cp -r daemon/modules/ggnotify/sample $RPM_BUILD_ROOT%{_sysconfdir}/modules/ggnotify
194 cp -r daemon/modules/dns/sample $RPM_BUILD_ROOT%{_sysconfdir}/modules/nofity
195 install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/lmsd
196 install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
197 %endif
198
199 %clean
200 rm -rf $RPM_BUILD_ROOT
201
202 %post
203 if [ -f /etc/httpd/httpd.conf ] && ! grep -q "^Include.*%{name}.conf" /etc/httpd/httpd.conf; then
204         echo "Include /etc/httpd/%{name}.conf" >> /etc/httpd/httpd.conf
205         if [ -f /var/lock/subsys/httpd ]; then
206                 /usr/sbin/apachectl restart 1>&2
207         fi
208 elif [ -d /etc/httpd/httpd.conf ]; then
209         ln -sf /etc/httpd/%{name}.conf /etc/httpd/httpd.conf/99_%{name}.conf
210         if [ -f /var/lock/subsys/httpd ]; then
211                 /usr/sbin/apachectl restart 1>&2
212         fi
213 fi
214
215 %post almsd
216 /sbin/chkconfig --add lmsd
217 if [ -f /var/lock/subsys/lmsd ]; then
218         /etc/rc.d/init.d/lmsd restart >&2
219 else
220         echo "Run \"/etc/rc.d/init.d/lmsd start\" to start almsd daemon."
221 fi
222
223 %preun
224 if [ "$1" = "0" ]; then
225         umask 027
226         if [ -d /etc/httpd/httpd.conf ]; then
227                 rm -f /etc/httpd/httpd.conf/99_%{name}.conf
228         else
229                 grep -v "^Include.*%{name}.conf" /etc/httpd/httpd.conf > \
230                         /etc/httpd/httpd.conf.tmp
231                 mv -f /etc/httpd/httpd.conf.tmp /etc/httpd/httpd.conf
232         fi
233         if [ -f /var/lock/subsys/httpd ]; then
234                 /usr/sbin/apachectl restart 1>&2
235         fi
236 fi
237
238 %preun almsd
239 if [ "$1" = "0" ]; then
240         if [ -f /var/lock/subsys/lmsd ]; then
241                 /etc/rc.d/init.d/lmsd stop >&2
242         fi
243         /sbin/chkconfig --del lmsd
244 fi
245
246 %triggerpostun -- %{name} <= 1.0.4
247 echo "WARNING!!!"
248 echo "_READ_ and upgrade LMS database:"
249 echo "MySQL: /usr/share/doc/%{name}-%{version}/UPGRADE-1.0-1.5.mysql.gz"
250 echo "PostgreSQL: /usr/share/doc/%{name}-%{version}/UPGRADE-1.0-1.5.pgsql.gz"
251 echo
252
253 %files
254 %defattr(644,root,root,755)
255 %doc doc/{AUTHORS,ChangeLog*,README,TODO,UPGRADE*,lms*}
256 %dir %{_sysconfdir}
257 %attr(640,root,http) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/*.ini
258 %config(noreplace) %verify(not size mtime md5) /etc/httpd/%{name}.conf
259 #
260 %dir %{_lmsvar}
261 %attr(770,root,http) %{_lmsvar}/backups
262 %attr(770,root,http) %{_lmsvar}/templates_c
263 #
264 %dir %{_lmsdir}
265 %{_lmsdir}/www
266 %exclude %{_lmsdir}/www/user
267 %{_lmsdir}/lib
268 %{_lmsdir}/modules
269 %exclude %{_lmsdir}/modules/sql.php
270 %{_lmsdir}/contrib
271 %{_lmsdir}/sample
272 %attr(755,root,root) %{_lmsdir}/sample/traffic_ipt.sh
273 %{_lmsdir}/templates
274 %exclude %{_lmsdir}/templates/sql.html
275 %exclude %{_lmsdir}/templates/sqlprint.html
276
277 %files scripts
278 %defattr(644,root,root,755)
279 %dir %{_sbindir}
280 %attr(755,root,root) %{_sbindir}/*
281
282 %files sqlpanel
283 %defattr(644,root,root,755)
284 %{_lmsdir}/modules/sql.php
285 %{_lmsdir}/templates/sql.html
286 %{_lmsdir}/templates/sqlprint.html
287
288 %files user
289 %defattr(644,root,root,755)
290 %{_lmsdir}/www/user
291
292 %if %{with almsd}
293 %files almsd
294 %defattr(644,root,root,755)
295 %doc daemon/{lms.ini.sample,TODO}
296 %attr(755,root,root) %{_sbindir}/almsd-*
297 %attr(755,root,root) /usr/lib/lms/*.so
298 %attr(754,root,root) /etc/rc.d/init.d/lmsd
299 /etc/lms/modules/*
300 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
301 %endif
This page took 0.077474 seconds and 4 git commands to generate.