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