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