]> git.pld-linux.org Git - packages/lms.git/blob - lms.spec
- Calendar fix (Michal Kowalczuk)
[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       1
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:  b9ace330b87a6253009a56358289821e
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-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} = %{version}-%{release}
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} = %{version}-%{release}
121
122 %description user
123 Simple user interface.
124
125 %description user -l pl
126 Prosty interfejs u¿ytkownika.
127
128 %package lmsd
129 Summary:        LAN Managment System - LMS system backend
130 Summary(pl):    LAN Managment System - backend systemu LMS
131 Group:          Networking/Utilities
132 Requires:       %{name} = %{version}-%{release}
133
134 %description lmsd
135 A program to manage the server by creating configuration files based
136 upon LMS database and restarting selected services.
137
138 %description lmsd -l pl
139 Program zarz±dzaj±cy serwerem poprzez tworzenie plików
140 konfiguracyjnych na podstawie bazy danych LMS'a i restartowanie
141 wybranych us³ug.
142
143 %prep
144 %setup -q -n %{name}
145 %patch0 -p1
146 %if "%{_lib}" == "lib64"
147 %patch1 -p1
148 %endif
149
150 %build
151 %if %{with lmsd}
152
153 cd daemon
154
155 ./configure --with-mysql
156 %{__make} \
157         CC='%{__cc}' CFLAGS='%{rpmcflags} -fPIC -DUSE_MYSQL -DLMS_LIB_DIR=\"/usr/lib/lms/\" -I../..'
158 mv lmsd lmsd-mysql
159
160 ./configure --with-pgsql
161 %{__make} lmsd \
162         CC='%{__cc}' \
163         CFLAGS='%{rpmcflags} -fPIC -DUSE_PGSQL -DLMS_LIB_DIR=\"/usr/lib/lms/\" -I../..'
164 mv lmsd lmsd-pgsql
165
166 cd ..
167 %endif
168
169 %install
170 rm -rf $RPM_BUILD_ROOT
171 install -d $RPM_BUILD_ROOT%{_sbindir} \
172            $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig,httpd} \
173            $RPM_BUILD_ROOT/etc/lms/modules/{dns,ggnofity,nofity} \
174            $RPM_BUILD_ROOT{%{_lmsvar}/{backups,templates_c},/usr/lib/lms} \
175            $RPM_BUILD_ROOT%{_lmsdir}/www/{img,doc,user}
176
177 install *.php $RPM_BUILD_ROOT%{_lmsdir}/www
178 install img/* $RPM_BUILD_ROOT%{_lmsdir}/www/img
179 cp -r doc/html $RPM_BUILD_ROOT%{_lmsdir}/www/doc
180 cp -r lib contrib modules templates sample $RPM_BUILD_ROOT%{_lmsdir}
181 install bin/* $RPM_BUILD_ROOT%{_sbindir}
182
183 install sample/%{name}.ini $RPM_BUILD_ROOT%{_sysconfdir}
184 install %{SOURCE1} $RPM_BUILD_ROOT/etc/httpd/%{name}.conf
185
186 # sqlpanel
187 install contrib/sqlpanel/sql.php $RPM_BUILD_ROOT%{_lmsdir}/modules
188 install contrib/sqlpanel/*.html $RPM_BUILD_ROOT%{_lmsdir}/templates
189
190 # user
191 cp -r contrib/customer/* $RPM_BUILD_ROOT%{_lmsdir}/www/user
192
193 # daemon
194 %if %{with lmsd}
195 install daemon/lmsd-* $RPM_BUILD_ROOT%{_sbindir}
196 install daemon/modules/*/*.so $RPM_BUILD_ROOT/usr/lib/lms
197 cp -r daemon/modules/dns/sample $RPM_BUILD_ROOT%{_sysconfdir}/modules/dns
198 cp -r daemon/modules/ggnotify/sample $RPM_BUILD_ROOT%{_sysconfdir}/modules/ggnotify
199 cp -r daemon/modules/dns/sample $RPM_BUILD_ROOT%{_sysconfdir}/modules/nofity
200 install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/lmsd
201 install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
202 %endif
203
204 %clean
205 rm -rf $RPM_BUILD_ROOT
206
207 %post
208 if [ -f /etc/httpd/httpd.conf ] && ! grep -q "^Include.*%{name}.conf" /etc/httpd/httpd.conf; then
209         echo "Include /etc/httpd/%{name}.conf" >> /etc/httpd/httpd.conf
210         if [ -f /var/lock/subsys/httpd ]; then
211                 /usr/sbin/apachectl restart 1>&2
212         fi
213 elif [ -d /etc/httpd/httpd.conf ]; then
214         ln -sf /etc/httpd/%{name}.conf /etc/httpd/httpd.conf/99_%{name}.conf
215         if [ -f /var/lock/subsys/httpd ]; then
216                 /usr/sbin/apachectl restart 1>&2
217         fi
218 fi
219
220 %post lmsd
221 /sbin/chkconfig --add lmsd
222 if [ -f /var/lock/subsys/lmsd ]; then
223         /etc/rc.d/init.d/lmsd restart >&2
224 else
225         echo "Run \"/etc/rc.d/init.d/lmsd start\" to start lmsd daemon."
226 fi
227
228 %preun
229 if [ "$1" = "0" ]; then
230         umask 027
231         if [ -d /etc/httpd/httpd.conf ]; then
232                 rm -f /etc/httpd/httpd.conf/99_%{name}.conf
233         else
234                 grep -v "^Include.*%{name}.conf" /etc/httpd/httpd.conf > \
235                         /etc/httpd/httpd.conf.tmp
236                 mv -f /etc/httpd/httpd.conf.tmp /etc/httpd/httpd.conf
237         fi
238         if [ -f /var/lock/subsys/httpd ]; then
239                 /usr/sbin/apachectl restart 1>&2
240         fi
241 fi
242
243 %preun lmsd
244 if [ "$1" = "0" ]; then
245         if [ -f /var/lock/subsys/lmsd ]; then
246                 /etc/rc.d/init.d/lmsd stop >&2
247         fi
248         /sbin/chkconfig --del lmsd
249 fi
250
251 %triggerpostun -- %{name} <= 1.0.4
252 echo "WARNING!!!"
253 echo "_READ_ and upgrade LMS database:"
254 echo "MySQL: /usr/share/doc/%{name}-%{version}/UPGRADE-1.0-1.5.mysql.gz"
255 echo "PostgreSQL: /usr/share/doc/%{name}-%{version}/UPGRADE-1.0-1.5.pgsql.gz"
256
257 %triggerpostun -- %{name} <= 1.2.0
258 echo "BEWARE:" 
259 echo "Automatic upgrade from LMS<= 1.2.0 is NO LONGER SUPPORTED by lms team" 
260 echo "You are advised to upgrade it manually" 
261 echo 
262
263 %files
264 %defattr(644,root,root,755)
265 %doc doc/{AUTHORS,ChangeLog*,README,UPGRADE*,lms*}
266 %dir %{_sysconfdir}
267 %attr(640,root,http) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/*.ini
268 %config(noreplace) %verify(not size mtime md5) /etc/httpd/%{name}.conf
269 #
270 %dir %{_lmsvar}
271 %attr(770,root,http) %{_lmsvar}/backups
272 %attr(770,root,http) %{_lmsvar}/templates_c
273 #
274 %dir %{_lmsdir}
275 %{_lmsdir}/www
276 %exclude %{_lmsdir}/www/user
277 %{_lmsdir}/lib
278 %{_lmsdir}/modules
279 %exclude %{_lmsdir}/modules/sql.php
280 %{_lmsdir}/contrib
281 %{_lmsdir}/sample
282 %attr(755,root,root) %{_lmsdir}/sample/traffic_ipt.pl
283 %{_lmsdir}/templates
284 %exclude %{_lmsdir}/templates/sql.html
285 %exclude %{_lmsdir}/templates/sqlprint.html
286
287 %files scripts
288 %defattr(644,root,root,755)
289 %dir %{_sbindir}
290 %attr(755,root,root) %{_sbindir}/*
291
292 %files sqlpanel
293 %defattr(644,root,root,755)
294 %{_lmsdir}/modules/sql.php
295 %{_lmsdir}/templates/sql.html
296 %{_lmsdir}/templates/sqlprint.html
297
298 %files user
299 %defattr(644,root,root,755)
300 %{_lmsdir}/www/user
301
302 %if %{with lmsd}
303 %files lmsd
304 %defattr(644,root,root,755)
305 %attr(755,root,root) %{_sbindir}/lmsd-*
306 %attr(755,root,root) /usr/lib/lms/*.so
307 %attr(754,root,root) /etc/rc.d/init.d/lmsd
308 /etc/lms/modules/*
309 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
310 %endif
This page took 0.064556 seconds and 4 git commands to generate.