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