]> git.ipfire.org Git - thirdparty/lldpd.git/blob - redhat/lldpd.spec
release: 1.0.4
[thirdparty/lldpd.git] / redhat / lldpd.spec
1 # This .spec file is targeted for SuSE OBS. It relies on macro that
2 # are not available on regular distributions. If you use directly
3 # rpmbuild, be sure to use something like `--define 'rhel_version
4 # 700'`.
5
6 # Conditional build options, disable with "--without xxx"
7 %bcond_without xml
8 %bcond_without cdp
9 %bcond_without edp
10 %bcond_without sonmp
11 %bcond_without fdp
12 %bcond_without lldpmed
13 %bcond_without dot1
14 %bcond_without dot3
15 %bcond_without custom
16 %bcond_without snmp
17
18 # On RHEL <= 6, compile with oldies
19 # For SuSE, SLE11 with a recent SP comes with 3.0. SLE12 comes with 3.12.
20 %if (0%{?rhel_version} > 0 && 0%{?rhel_version} < 700) || (0%{?centos_version} > 0 && 0%{?centos_version} < 700)
21 %bcond_without oldies
22 %else
23 %bcond_with oldies
24 %endif
25
26 # On RHEL < 7, disable systemd
27 # On SuSE < 12, disable systemd
28 %if (0%{?rhel_version} > 0 && 0%{?rhel_version} < 700) || (0%{?centos_version} > 0 && 0%{?centos_version} < 700) || (0%{?suse_version} > 0 && 0%{?suse_version} < 1210)
29 %bcond_with systemd
30 %else
31 %bcond_without systemd
32 %endif
33
34 # On RHEL < 7, use embedded libevent
35 %if (0%{?rhel_version} > 0) || (0%{?centos_version} > 0 && 0%{?centos_version} < 700) || (0%{?suse_version} > 0 && 0%{?suse_version} < 1200)
36 %bcond_with system_libevent
37 %else
38 %bcond_without system_libevent
39 %endif
40
41 %define lldpd_user _lldpd
42 %define lldpd_group _lldpd
43 %define lldpd_chroot /var/run/lldpd
44
45 Summary: Implementation of IEEE 802.1ab (LLDP)
46 Name: lldpd
47 Version: 1.0.4
48 Release: 1%{?dist}
49 License: MIT
50 Group: System/Management
51 URL: http://vincentbernat.github.com/lldpd/
52 Source0: http://media.luffy.cx/files/lldpd/%{name}-%{version}.tar.gz
53 Source1: lldpd.init%{?suse_version:.suse}
54 Source2: lldpd.sysconfig
55
56 BuildRequires: pkgconfig
57 %if %{with system_libevent}
58 BuildRequires: libevent-devel
59 %endif
60 BuildRequires: readline-devel
61 BuildRequires: libcap-devel
62 %if %{with snmp}
63 BuildRequires: net-snmp-devel
64 BuildRequires: openssl-devel
65 %{!?suse_version:BuildRequires: lm_sensors-devel}
66 %endif
67 %if %{with xml}
68 BuildRequires: libxml2-devel
69 %endif
70 %if %{with systemd}
71 %if 0%{?suse_version}
72 BuildRequires: systemd-rpm-macros
73 %{?systemd_requires}
74 %else
75 Requires(post): systemd
76 Requires(preun): systemd
77 Requires(postun): systemd
78 BuildRequires: systemd-units
79 %endif
80 %endif
81 %if 0%{?suse_version}
82 PreReq: %fillup_prereq %insserv_prereq pwdutils
83 %else
84 Requires(pre): /usr/sbin/groupadd /usr/sbin/useradd
85 Requires(post): chkconfig
86 Requires(preun): chkconfig
87 Requires(preun): initscripts
88 Requires(postun): initscripts
89 %endif
90
91 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
92
93 %description
94 This implementation provides LLDP sending and reception, supports VLAN
95 and includes an SNMP subagent that can interface to an SNMP agent
96 through AgentX protocol.
97
98 LLDP is an industry standard protocol designed to supplant proprietary
99 Link-Layer protocols such as Extreme EDP (Extreme Discovery Protocol)
100 and CDP (Cisco Discovery Protocol). The goal of LLDP is to provide an
101 inter-vendor compatible mechanism to deliver Link-Layer notifications
102 to adjacent network devices.
103
104 This daemon is also able to deal with CDP, FDP, SONMP and EDP
105 protocol. It also handles LLDP-MED extension.
106
107 %package devel
108 Summary: Implementation of IEEE 802.1ab - Tools and header files for developers
109 Group: Development/Libraries/C
110 BuildRequires: pkgconfig
111 Requires: lldpd = %{version}-%{release}
112
113 %description devel
114 This package is required to develop alternate clients for lldpd.
115
116 LLDP is an industry standard protocol designed to supplant proprietary
117 Link-Layer protocols such as Extreme EDP (Extreme Discovery Protocol)
118 and CDP (Cisco Discovery Protocol). The goal of LLDP is to provide an
119 inter-vendor compatible mechanism to deliver Link-Layer notifications
120 to adjacent network devices.
121
122 %prep
123 %setup -q
124 %build
125 %configure \
126 %if %{with snmp}
127 --with-snmp \
128 %endif
129 %if %{with xml}
130 --with-xml \
131 %endif
132 %if %{with cdp}
133 --enable-cdp \
134 %else
135 --disable-cdp \
136 %endif
137 %if %{with edp}
138 --enable-edp \
139 %else
140 --disable-edp \
141 %endif
142 %if %{with sonmp}
143 --enable-sonmp \
144 %else
145 --disable-sonmp \
146 %endif
147 %if %{with fdp}
148 --enable-fdp \
149 %else
150 --disable-fdp \
151 %endif
152 %if %{with lldpmed}
153 --enable-lldpmed \
154 %else
155 --disable-lldpmed \
156 %endif
157 %if %{with dot1}
158 --enable-dot1 \
159 %else
160 --disable-dot1 \
161 %endif
162 %if %{with dot3}
163 --enable-dot3 \
164 %else
165 --disable-dot3 \
166 %endif
167 %if %{with custom}
168 --enable-custom \
169 %else
170 --disable-custom \
171 %endif
172 %if %{with oldies}
173 --enable-oldies \
174 %else
175 --disable-oldies \
176 %endif
177 --with-privsep-user=%lldpd_user \
178 --with-privsep-group=%lldpd_group \
179 --with-privsep-chroot=%lldpd_chroot \
180 %if %{without systemd}
181 --with-systemdsystemunitdir=no \
182 %else
183 --with-systemdsystemunitdir=%{_unitdir} \
184 %endif
185 --with-sysusersdir=no \
186 --prefix=%{_usr} \
187 --localstatedir=%{_localstatedir} \
188 --sysconfdir=%{_sysconfdir} \
189 --libdir=%{_libdir} \
190 --docdir=%{_docdir}/lldpd \
191 --enable-pie
192
193 [ -f %{_includedir}/net-snmp/agent/struct.h ] || touch src/struct.h
194 make %{?_smp_mflags}
195
196 %install
197 make install DESTDIR=$RPM_BUILD_ROOT
198 %if %{without systemd}
199 install -d $RPM_BUILD_ROOT/%{_initrddir}
200 install -m755 %{SOURCE1} $RPM_BUILD_ROOT/%{_initrddir}/lldpd
201 %endif
202 %if 0%{?suse_version}
203 mkdir -p ${RPM_BUILD_ROOT}/var/adm/fillup-templates
204 install -m700 %{SOURCE2} ${RPM_BUILD_ROOT}/var/adm/fillup-templates/sysconfig.lldpd
205 %else
206 install -d $RPM_BUILD_ROOT/etc/sysconfig
207 install -m644 %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/lldpd
208 %endif
209
210 %pre
211 # Create lldpd user/group
212 if getent group %lldpd_group >/dev/null 2>&1 ; then : ; else \
213 %{_sbindir}/groupadd -r %lldpd_group > /dev/null 2>&1 || exit 1 ; fi
214 if getent passwd %lldpd_user >/dev/null 2>&1 ; then : ; else \
215 %{_sbindir}/useradd -g %lldpd_group -M -r -s /sbin/nologin \
216 -c "LLDP daemon" -d %lldpd_chroot %lldpd_user 2> /dev/null \
217 || exit 1 ; fi
218 %if 0%{?suse_version} >= 1210 && %{with systemd}
219 %service_add_pre lldpd.service
220 %endif
221
222 %if 0%{?suse_version}
223 # Service management for SuSE
224
225 %if 0%{?suse_version} >= 1210 && %{with systemd}
226 %post
227 %service_add_post lldpd.service
228 %{fillup_only}
229 %preun
230 %service_del_preun lldpd.service
231 %postun
232 %service_del_postun lldpd.service
233 %else
234 %post
235 /sbin/ldconfig
236 %{fillup_and_insserv lldpd}
237 %postun
238 /sbin/ldconfig
239 %restart_on_update lldpd
240 %insserv_cleanup
241 %preun
242 %stop_on_removal lldpd
243 %endif
244
245 %else
246 %if %{without systemd}
247 # Service management for Redhat/CentOS without systemd
248
249 %post
250 /sbin/ldconfig
251 /sbin/chkconfig --add lldpd
252 %postun
253 /sbin/ldconfig
254 if [ "$1" -ge "1" ]; then
255 /sbin/service lldpd condrestart >/dev/null 2>&1 || :
256 fi
257 %preun
258 if [ "$1" = "0" ]; then
259 /sbin/service lldpd stop > /dev/null 2>&1
260 /sbin/chkconfig --del lldpd
261 fi
262
263 %else
264 # Service management for Redhat/CentOS with systemd
265
266 %post
267 /sbin/ldconfig
268 %systemd_post lldpd.service
269
270 %preun
271 %systemd_preun lldpd.service
272
273 %postun
274 %systemd_postun_with_restart lldpd.service
275 /sbin/ldconfig
276
277 %endif
278 %endif
279
280 %clean
281 rm -rf $RPM_BUILD_ROOT
282
283 %files
284 %defattr(-,root,root,-)
285 %dir %{_docdir}/lldpd
286 %doc %{_docdir}/lldpd/NEWS
287 %doc %{_docdir}/lldpd/LICENSE
288 %doc %{_docdir}/lldpd/ChangeLog
289 %doc %{_docdir}/lldpd/README.md
290 %doc %{_docdir}/lldpd/CONTRIBUTE.md
291 %{_sbindir}/lldpd
292 %{_sbindir}/lldpctl
293 %attr(4750,%lldpd_user,adm) %{_sbindir}/lldpcli
294 %{_libdir}/liblldpctl.so.*
295 %{_datadir}/zsh
296 %{_datadir}/bash-completion
297 %doc %{_mandir}/man8/lldp*
298 %config %{_sysconfdir}/lldpd.d
299 %if %{without systemd}
300 %config %attr(755,root,root) %{_initrddir}/lldpd
301 %else
302 %{_unitdir}/lldpd.service
303 %endif
304 %if 0%{?suse_version}
305 %attr(644,root,root) %{_var}/adm/fillup-templates/sysconfig.lldpd
306 %else
307 %config(noreplace) %{_sysconfdir}/sysconfig/lldpd
308 %endif
309
310 %files devel
311 %defattr(-,root,root)
312 %{_libdir}/liblldpctl.so
313 %{_libdir}/liblldpctl.a
314 %{_libdir}/liblldpctl.la
315 %{_libdir}/pkgconfig/lldpctl.pc
316 %{_includedir}/lldpctl.h
317 %{_includedir}/lldp-const.h
318
319 %changelog
320 * Sun Jun 15 2019 Vincent Bernat <bernat@luffy.cx> - 1.0.4-1
321 - New upstream version.
322
323 * Mon Dec 10 2018 Vincent Bernat <bernat@luffy.cx> - 1.0.3-1
324 - New upstream version.
325
326 * Sat Dec 01 2018 Vincent Bernat <bernat@luffy.cx> - 1.0.2-1
327 - New upstream version.
328
329 * Mon Apr 09 2018 Vincent Bernat <bernat@luffy.cx> - 1.0.1-1
330 - New upstream version.
331
332 * Sun Apr 08 2018 Vincent Bernat <bernat@luffy.cx> - 1.0.0-1
333 - New upstream version.
334
335 * Tue Nov 21 2017 Vincent Bernat <bernat@luffy.cx> - 0.9.9-1
336 - New upstream version.
337
338 * Sun Aug 20 2017 Vincent Bernat <bernat@luffy.cx> - 0.9.8-1
339 - New upstream version.
340
341 * Sun Mar 19 2017 Vincent Bernat <bernat@luffy.cx> - 0.9.7-1
342 - New upstream version.
343
344 * Sat Jan 21 2017 Vincent Bernat <bernat@luffy.cx> - 0.9.6-1
345 - New upstream version.
346
347 * Fri Sep 30 2016 Vincent Bernat <bernat@luffy.cx> - 0.9.5-1
348 - New upstream version.
349
350 * Fri Jun 17 2016 Vincent Bernat <bernat@luffy.cx> - 0.9.4-1
351 - New upstream version.
352
353 * Sat May 21 2016 Vincent Bernat <bernat@luffy.cx> - 0.9.3-1
354 - New upstream version.
355
356 * Sat Mar 19 2016 Vincent Bernat <bernat@luffy.cx> - 0.9.2-1
357 - New upstream version.
358
359 * Sat Feb 20 2016 Vincent Bernat <bernat@luffy.cx> - 0.9.1-1
360 - New upstream version.
361
362 * Fri Jan 01 2016 Vincent Bernat <bernat@luffy.cx> - 0.9.0-1
363 - New upstream version.
364 - Do not rely on libnl3.
365
366 * Sun Dec 27 2015 Vincent Bernat <bernat@luffy.cx> - 0.8.0-1
367 - New upstream version.
368 - Use system libnl3 when possible.
369 - Use system libevent when possible.
370
371 * Wed Sep 09 2015 Vincent Bernat <bernat@luffy.cx> - 0.7.17-1
372 - New upstream version.
373
374 * Fri Aug 07 2015 Vincent Bernat <bernat@luffy.cx> - 0.7.16-1
375 - New upstream version.
376
377 * Wed May 20 2015 Vincent Bernat <bernat@luffy.cx> - 0.7.15-1
378 - New upstream version.
379
380 * Sat Apr 04 2015 Vincent Bernat <bernat@luffy.cx> - 0.7.14-1
381 - New upstream version.
382
383 * Tue Dec 30 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.13-1
384 - New upstream version.
385
386 * Sat Nov 22 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.12-1
387 - New upstream version.
388 - Completion for bash and zsh.
389
390 * Wed Oct 08 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.11-1
391 - New upstream version.
392 - Completion for bash and zsh.
393
394 * Mon Jul 21 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.10-1
395 - New upstream version.
396
397 * Wed May 28 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.9-1
398 - New upstream version.
399
400 * Sun Apr 13 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.8-1
401 - New upstream version.
402
403 * Sun Nov 10 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.7-1
404 - New upstream version.
405
406 * Fri Jul 12 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.6-1
407 - New upstream version.
408
409 * Sat Jun 22 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.5-1
410 - New upstream version.
411
412 * Sun May 12 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.3-1
413 - New upstream version.
414
415 * Fri Apr 19 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.2-1
416 - New upstream version.
417
418 * Sat Jan 12 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.1-1
419 - New upstream version.
420
421 * Sun Jan 06 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.0-1
422 - New upstream version.
423 - Requires readline-devel.
424 - Ships lldpcli.
425
426 * Thu Sep 27 2012 Vincent Bernat <bernat@luffy.cx> - 0.6.1-1
427 - New upstream version
428 - Do not require libevent, use embedded copy.
429 - Provide a -devel package.
430
431 * Fri Jun 11 2010 Vincent Bernat <bernat@luffy.cx> - 0.5.1-1
432 - New upstream version
433 - Define bcond_without and with macros if not defined to be compatible
434 with RHEL
435 - Requires useradd and groupadd
436 - Adapt to make it work with SuSE
437 - Provide an init script targetted at SuSE
438 - Build require lm_sensors-devel on RHEL
439
440 * Fri Mar 12 2010 Vincent Bernat <bernat@luffy.cx> - 0.5.0-1
441 - New upstream version
442 - Add XML support
443
444 * Tue May 19 2009 Vincent Bernat <bernat@luffy.cx> - 0.4.0-1
445 - Add variables
446 - Enable SNMP support
447 - Add _lldpd user creation
448 - Add initscript
449 - New upstream version
450
451 * Mon May 18 2009 Dean Hamstead <dean.hamstead@optusnet.com.au> - 0.3.3-1
452 - Initial attempt