]> git.ipfire.org Git - thirdparty/lldpd.git/blame - redhat/lldpd.spec
release: 1.0.18
[thirdparty/lldpd.git] / redhat / lldpd.spec
CommitLineData
cd66d751
VB
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'`.
53c653ea
PK
5
6# Conditional build options, disable with "--without xxx"
c3bab3ed 7%bcond_without xml
53c653ea
PK
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
fb1b78bb 15%bcond_without custom
7b166df3 16%bcond_without snmp
7b166df3 17
780e843d 18# On RHEL <= 6, compile with oldies
f7ce4668 19# For SuSE, SLE11 with a recent SP comes with 3.0. SLE12 comes with 3.12.
d788766d 20%if (0%{?rhel_version} > 0 && 0%{?rhel_version} < 700) || (0%{?centos_version} > 0 && 0%{?centos_version} < 700)
5d81ecdd
VB
21%bcond_without oldies
22%else
23%bcond_with oldies
24%endif
25
6cefe733 26# On RHEL < 7, disable systemd
f7ce4668 27# On SuSE < 12, disable systemd
d788766d 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)
6cefe733
VB
29%bcond_with systemd
30%else
31%bcond_without systemd
32%endif
33
3637cb7a 34# On RHEL < 7, use embedded libevent
d788766d 35%if (0%{?rhel_version} > 0) || (0%{?centos_version} > 0 && 0%{?centos_version} < 700) || (0%{?suse_version} > 0 && 0%{?suse_version} < 1200)
3637cb7a
VB
36%bcond_with system_libevent
37%else
38%bcond_without system_libevent
39%endif
40
edc4813f
VB
41%define lldpd_user _lldpd
42%define lldpd_group _lldpd
43%define lldpd_chroot /var/run/lldpd
44
d623a64a 45Summary: Implementation of IEEE 802.1ab (LLDP)
80530161 46Name: lldpd
91728d2e 47Version: 1.0.18
edc4813f 48Release: 1%{?dist}
70845fe4 49License: ISC
2e441b24 50Group: System/Management
9b50cef9 51URL: https://lldpd.github.io/
70943e34 52Source0: http://media.luffy.cx/files/lldpd/%{name}-%{version}.tar.gz
8e555861 53Source1: lldpd.init%{?suse_version:.suse}
26819154 54Source2: lldpd.sysconfig
edc4813f 55
68b375c3 56BuildRequires: pkgconfig
3637cb7a 57%if %{with system_libevent}
2145c7cf 58BuildRequires: libevent-devel
3637cb7a 59%endif
23e7fa38 60BuildRequires: readline-devel
8a4e0fbf 61BuildRequires: libcap-devel
53c653ea 62%if %{with snmp}
edc4813f 63BuildRequires: net-snmp-devel
20ffcb8e 64BuildRequires: openssl-devel
053d9978 65%{!?suse_version:BuildRequires: lm_sensors-devel}
edc4813f 66%endif
c3bab3ed
VB
67%if %{with xml}
68BuildRequires: libxml2-devel
c3bab3ed 69%endif
6cefe733 70%if %{with systemd}
5a9da534
VB
71%if 0%{?suse_version}
72BuildRequires: systemd-rpm-macros
73%{?systemd_requires}
74%else
6cefe733
VB
75Requires(post): systemd
76Requires(preun): systemd
77Requires(postun): systemd
6cefe733
VB
78BuildRequires: systemd-units
79%endif
5a9da534 80%endif
d623a64a
VB
81%if 0%{?suse_version}
82PreReq: %fillup_prereq %insserv_prereq pwdutils
8e555861 83%else
3336988a 84Requires(pre): /usr/sbin/groupadd /usr/sbin/useradd
8e555861
VB
85Requires(post): chkconfig
86Requires(preun): chkconfig
87Requires(preun): initscripts
88Requires(postun): initscripts
d623a64a 89%endif
80530161 90
5592bec9 91BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
80530161 92
80530161 93%description
edc4813f
VB
94This implementation provides LLDP sending and reception, supports VLAN
95and includes an SNMP subagent that can interface to an SNMP agent
96through AgentX protocol.
80530161 97
edc4813f
VB
98LLDP is an industry standard protocol designed to supplant proprietary
99Link-Layer protocols such as Extreme EDP (Extreme Discovery Protocol)
100and CDP (Cisco Discovery Protocol). The goal of LLDP is to provide an
101inter-vendor compatible mechanism to deliver Link-Layer notifications
102to adjacent network devices.
80530161 103
edc4813f
VB
104This daemon is also able to deal with CDP, FDP, SONMP and EDP
105protocol. It also handles LLDP-MED extension.
80530161 106
b2160607
VB
107%package devel
108Summary: Implementation of IEEE 802.1ab - Tools and header files for developers
2e441b24 109Group: Development/Libraries/C
fae46e61 110BuildRequires: pkgconfig
b2160607
VB
111Requires: lldpd = %{version}-%{release}
112
113%description devel
114This package is required to develop alternate clients for lldpd.
115
b5b304e8
VB
116LLDP is an industry standard protocol designed to supplant proprietary
117Link-Layer protocols such as Extreme EDP (Extreme Discovery Protocol)
118and CDP (Cisco Discovery Protocol). The goal of LLDP is to provide an
119inter-vendor compatible mechanism to deliver Link-Layer notifications
120to adjacent network devices.
121
80530161 122%prep
edc4813f 123%setup -q
80530161 124%build
edc4813f 125%configure \
53c653ea 126%if %{with snmp}
edc4813f
VB
127 --with-snmp \
128%endif
c3bab3ed
VB
129%if %{with xml}
130 --with-xml \
131%endif
53c653ea 132%if %{with cdp}
edc4813f
VB
133 --enable-cdp \
134%else
135 --disable-cdp \
136%endif
53c653ea 137%if %{with edp}
edc4813f
VB
138 --enable-edp \
139%else
140 --disable-edp \
141%endif
53c653ea 142%if %{with sonmp}
edc4813f
VB
143 --enable-sonmp \
144%else
145 --disable-sonmp \
146%endif
53c653ea 147%if %{with fdp}
edc4813f
VB
148 --enable-fdp \
149%else
150 --disable-fdp \
151%endif
53c653ea 152%if %{with lldpmed}
edc4813f
VB
153 --enable-lldpmed \
154%else
155 --disable-lldpmed \
156%endif
53c653ea 157%if %{with dot1}
edc4813f
VB
158 --enable-dot1 \
159%else
160 --disable-dot1 \
161%endif
53c653ea 162%if %{with dot3}
edc4813f
VB
163 --enable-dot3 \
164%else
165 --disable-dot3 \
fb1b78bb
AA
166%endif
167%if %{with custom}
168 --enable-custom \
169%else
170 --disable-custom \
5d81ecdd
VB
171%endif
172%if %{with oldies}
173 --enable-oldies \
174%else
175 --disable-oldies \
edc4813f
VB
176%endif
177 --with-privsep-user=%lldpd_user \
178 --with-privsep-group=%lldpd_group \
179 --with-privsep-chroot=%lldpd_chroot \
6cefe733 180%if %{without systemd}
82e23221 181 --with-systemdsystemunitdir=no \
0e6b2507
VB
182%else
183 --with-systemdsystemunitdir=%{_unitdir} \
6cefe733 184%endif
a9f77488 185 --with-sysusersdir=no \
5cffb4e7
VB
186 --prefix=%{_usr} \
187 --localstatedir=%{_localstatedir} \
188 --sysconfdir=%{_sysconfdir} \
189 --libdir=%{_libdir} \
a8add742 190 --docdir=%{_docdir}/lldpd \
3e581640 191 --enable-pie
edc4813f 192
5cffb4e7 193[ -f %{_includedir}/net-snmp/agent/struct.h ] || touch src/struct.h
80530161
VB
194make %{?_smp_mflags}
195
196%install
80530161 197make install DESTDIR=$RPM_BUILD_ROOT
6cefe733 198%if %{without systemd}
8e555861
VB
199install -d $RPM_BUILD_ROOT/%{_initrddir}
200install -m755 %{SOURCE1} $RPM_BUILD_ROOT/%{_initrddir}/lldpd
6cefe733 201%endif
d623a64a
VB
202%if 0%{?suse_version}
203mkdir -p ${RPM_BUILD_ROOT}/var/adm/fillup-templates
204install -m700 %{SOURCE2} ${RPM_BUILD_ROOT}/var/adm/fillup-templates/sysconfig.lldpd
205%else
3d6585f3 206install -d $RPM_BUILD_ROOT/etc/sysconfig
26819154 207install -m644 %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/lldpd
d623a64a 208%endif
edc4813f
VB
209
210%pre
211# Create lldpd user/group
212if getent group %lldpd_group >/dev/null 2>&1 ; then : ; else \
7b166df3 213 %{_sbindir}/groupadd -r %lldpd_group > /dev/null 2>&1 || exit 1 ; fi
edc4813f 214if getent passwd %lldpd_user >/dev/null 2>&1 ; then : ; else \
14da0d3c 215 %{_sbindir}/useradd -g %lldpd_group -M -r -s /sbin/nologin \
edc4813f
VB
216 -c "LLDP daemon" -d %lldpd_chroot %lldpd_user 2> /dev/null \
217 || exit 1 ; fi
5a9da534
VB
218%if 0%{?suse_version} >= 1210 && %{with systemd}
219%service_add_pre lldpd.service
220%endif
80530161 221
d623a64a
VB
222%if 0%{?suse_version}
223# Service management for SuSE
224
5a9da534
VB
225%if 0%{?suse_version} >= 1210 && %{with systemd}
226%post
227%service_add_post lldpd.service
0e892b15 228%{fillup_only}
5a9da534
VB
229%preun
230%service_del_preun lldpd.service
231%postun
232%service_del_postun lldpd.service
233%else
3d6585f3 234%post
a5d1ce75 235/sbin/ldconfig
d623a64a
VB
236%{fillup_and_insserv lldpd}
237%postun
a5d1ce75 238/sbin/ldconfig
d623a64a
VB
239%restart_on_update lldpd
240%insserv_cleanup
241%preun
242%stop_on_removal lldpd
5a9da534 243%endif
3d6585f3 244
279bfd63
VB
245%else
246%if %{without systemd}
6cefe733 247# Service management for Redhat/CentOS without systemd
d623a64a
VB
248
249%post
a5d1ce75 250/sbin/ldconfig
d623a64a 251/sbin/chkconfig --add lldpd
3d6585f3 252%postun
a5d1ce75 253/sbin/ldconfig
3d6585f3 254if [ "$1" -ge "1" ]; then
f00bebf6 255 /sbin/service lldpd condrestart >/dev/null 2>&1 || :
3d6585f3 256fi
3d6585f3
VB
257%preun
258if [ "$1" = "0" ]; then
8e555861 259 /sbin/service lldpd stop > /dev/null 2>&1
3d6585f3
VB
260 /sbin/chkconfig --del lldpd
261fi
262
6cefe733
VB
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
279bfd63 277%endif
d623a64a
VB
278%endif
279
80530161
VB
280%clean
281rm -rf $RPM_BUILD_ROOT
282
283%files
284%defattr(-,root,root,-)
b2160607
VB
285%dir %{_docdir}/lldpd
286%doc %{_docdir}/lldpd/NEWS
3cf46664 287%doc %{_docdir}/lldpd/LICENSE
7e431daf 288%doc %{_docdir}/lldpd/ChangeLog
b2160607 289%doc %{_docdir}/lldpd/README.md
03b0a190 290%doc %{_docdir}/lldpd/CONTRIBUTE.md
b2160607
VB
291%{_sbindir}/lldpd
292%{_sbindir}/lldpctl
7db1168e 293%attr(4750,%lldpd_user,adm) %{_sbindir}/lldpcli
a5d1ce75 294%{_libdir}/liblldpctl.so.*
4ed3c3d8 295%{_datadir}/zsh
98bf70e3 296%{_datadir}/bash-completion
b2160607 297%doc %{_mandir}/man8/lldp*
c0e428ac 298%config %{_sysconfdir}/lldpd.d
6cefe733 299%if %{without systemd}
b2160607 300%config %attr(755,root,root) %{_initrddir}/lldpd
6cefe733
VB
301%else
302%{_unitdir}/lldpd.service
303%endif
d623a64a 304%if 0%{?suse_version}
5cffb4e7 305%attr(644,root,root) %{_var}/adm/fillup-templates/sysconfig.lldpd
d623a64a 306%else
5cffb4e7 307%config(noreplace) %{_sysconfdir}/sysconfig/lldpd
d623a64a 308%endif
80530161 309
b2160607
VB
310%files devel
311%defattr(-,root,root)
a5d1ce75
VB
312%{_libdir}/liblldpctl.so
313%{_libdir}/liblldpctl.a
b2160607
VB
314%{_libdir}/pkgconfig/lldpctl.pc
315%{_includedir}/lldpctl.h
316%{_includedir}/lldp-const.h
317
80530161 318%changelog
91728d2e
VB
319* Sun Jan 14 2024 Vincent Bernat <bernat@luffy.cx> - 1.0.18-1
320- New upstream version.
321
bf5457bd
VB
322* Thu May 18 2023 Vincent Bernat <bernat@luffy.cx> - 1.0.17-1
323- New upstream version.
324
7a595f1a
VB
325* Fri Nov 11 2022 Vincent Bernat <bernat@luffy.cx> - 1.0.16-1
326- New upstream version.
327
4489027c
VB
328* Wed Aug 17 2022 Vincent Bernat <bernat@luffy.cx> - 1.0.15-1
329- New upstream version.
330
15b9de12
VB
331* Sat May 21 2022 Vincent Bernat <bernat@luffy.cx> - 1.0.14-1
332- New upstream version.
333
9576b78e
VB
334* Sat Nov 13 2021 Vincent Bernat <bernat@luffy.cx> - 1.0.13-1
335- New upstream version.
336
2129b015
VB
337* Fri Aug 20 2021 Vincent Bernat <bernat@luffy.cx> - 1.0.12-1
338- New upstream version.
339
1b297ccc
VB
340* Sat May 01 2021 Vincent Bernat <bernat@luffy.cx> - 1.0.11-1
341- New upstream version.
342
7749b008
VB
343* Fri Apr 09 2021 Vincent Bernat <bernat@luffy.cx> - 1.0.10-1
344- New upstream version.
345
a368f3ff
VB
346* Fri Apr 02 2021 Vincent Bernat <bernat@luffy.cx> - 1.0.9-1
347- New upstream version.
348
0a251e25
VB
349* Wed Jan 13 2021 Vincent Bernat <bernat@luffy.cx> - 1.0.8-1
350- New upstream version.
351
55e14377
VB
352* Sat Oct 31 2020 Vincent Bernat <bernat@luffy.cx> - 1.0.7-1
353- New upstream version.
354
06ae963f
VB
355* Sat Sep 05 2020 Vincent Bernat <bernat@luffy.cx> - 1.0.6-1
356- New upstream version.
357
6d83fa56
VB
358* Sat Feb 01 2020 Vincent Bernat <bernat@luffy.cx> - 1.0.5-1
359- New upstream version.
360
361* Sun Jun 15 2019 Vincent Bernat <bernat@luffy.cx> - 1.0.4-1
1507a003
VB
362- New upstream version.
363
0c08843c
VB
364* Mon Dec 10 2018 Vincent Bernat <bernat@luffy.cx> - 1.0.3-1
365- New upstream version.
366
f1a6e154
VB
367* Sat Dec 01 2018 Vincent Bernat <bernat@luffy.cx> - 1.0.2-1
368- New upstream version.
369
4ff8626e
VB
370* Mon Apr 09 2018 Vincent Bernat <bernat@luffy.cx> - 1.0.1-1
371- New upstream version.
372
99a0b07d
VB
373* Sun Apr 08 2018 Vincent Bernat <bernat@luffy.cx> - 1.0.0-1
374- New upstream version.
375
722f74c4
VB
376* Tue Nov 21 2017 Vincent Bernat <bernat@luffy.cx> - 0.9.9-1
377- New upstream version.
378
41aeb617
VB
379* Sun Aug 20 2017 Vincent Bernat <bernat@luffy.cx> - 0.9.8-1
380- New upstream version.
381
6b7fa964
VB
382* Sun Mar 19 2017 Vincent Bernat <bernat@luffy.cx> - 0.9.7-1
383- New upstream version.
384
4c97ef8c
VB
385* Sat Jan 21 2017 Vincent Bernat <bernat@luffy.cx> - 0.9.6-1
386- New upstream version.
387
396961a0
VB
388* Fri Sep 30 2016 Vincent Bernat <bernat@luffy.cx> - 0.9.5-1
389- New upstream version.
390
7522a4f0
VB
391* Fri Jun 17 2016 Vincent Bernat <bernat@luffy.cx> - 0.9.4-1
392- New upstream version.
393
0517bd3b
VB
394* Sat May 21 2016 Vincent Bernat <bernat@luffy.cx> - 0.9.3-1
395- New upstream version.
396
11c5322c
VB
397* Sat Mar 19 2016 Vincent Bernat <bernat@luffy.cx> - 0.9.2-1
398- New upstream version.
399
37ca8e1a
VB
400* Sat Feb 20 2016 Vincent Bernat <bernat@luffy.cx> - 0.9.1-1
401- New upstream version.
402
4ab5a8c2
VB
403* Fri Jan 01 2016 Vincent Bernat <bernat@luffy.cx> - 0.9.0-1
404- New upstream version.
405- Do not rely on libnl3.
406
4e82e0bc 407* Sun Dec 27 2015 Vincent Bernat <bernat@luffy.cx> - 0.8.0-1
2145c7cf 408- New upstream version.
fa12cb8f 409- Use system libnl3 when possible.
3637cb7a 410- Use system libevent when possible.
2145c7cf 411
8e89804d
VB
412* Wed Sep 09 2015 Vincent Bernat <bernat@luffy.cx> - 0.7.17-1
413- New upstream version.
414
96a1dec9
VB
415* Fri Aug 07 2015 Vincent Bernat <bernat@luffy.cx> - 0.7.16-1
416- New upstream version.
417
b896513b
VB
418* Wed May 20 2015 Vincent Bernat <bernat@luffy.cx> - 0.7.15-1
419- New upstream version.
420
8de206fd
VB
421* Sat Apr 04 2015 Vincent Bernat <bernat@luffy.cx> - 0.7.14-1
422- New upstream version.
423
2216fdf1 424* Tue Dec 30 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.13-1
d9cf6428
VB
425- New upstream version.
426
2216fdf1 427* Sat Nov 22 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.12-1
0882639d
VB
428- New upstream version.
429- Completion for bash and zsh.
430
62446808
VB
431* Wed Oct 08 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.11-1
432- New upstream version.
e202ae37 433- Completion for bash and zsh.
62446808 434
3620ee09
VB
435* Mon Jul 21 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.10-1
436- New upstream version.
437
70943e34
VB
438* Wed May 28 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.9-1
439- New upstream version.
440
412a1dad
VB
441* Sun Apr 13 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.8-1
442- New upstream version.
443
e537ab77 444* Sun Nov 10 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.7-1
d72c2c59
VB
445- New upstream version.
446
03b0a190
VB
447* Fri Jul 12 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.6-1
448- New upstream version.
449
444c6862 450* Sat Jun 22 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.5-1
6712d3ec
VB
451- New upstream version.
452
e91ca9d0
VB
453* Sun May 12 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.3-1
454- New upstream version.
455
ef1ae4e7
VB
456* Fri Apr 19 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.2-1
457- New upstream version.
458
a6c894e3
VB
459* Sat Jan 12 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.1-1
460- New upstream version.
461
0eb9ad16
VB
462* Sun Jan 06 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.0-1
463- New upstream version.
464- Requires readline-devel.
465- Ships lldpcli.
466
e537ab77 467* Thu Sep 27 2012 Vincent Bernat <bernat@luffy.cx> - 0.6.1-1
b2160607
VB
468- New upstream version
469- Do not require libevent, use embedded copy.
470- Provide a -devel package.
471
2ceb9bb7
VB
472* Fri Jun 11 2010 Vincent Bernat <bernat@luffy.cx> - 0.5.1-1
473- New upstream version
474- Define bcond_without and with macros if not defined to be compatible
475 with RHEL
8e555861 476- Requires useradd and groupadd
d623a64a 477- Adapt to make it work with SuSE
8e555861 478- Provide an init script targetted at SuSE
053d9978 479- Build require lm_sensors-devel on RHEL
2ceb9bb7 480
c3bab3ed
VB
481* Fri Mar 12 2010 Vincent Bernat <bernat@luffy.cx> - 0.5.0-1
482- New upstream version
483- Add XML support
484
3d6585f3
VB
485* Tue May 19 2009 Vincent Bernat <bernat@luffy.cx> - 0.4.0-1
486- Add variables
487- Enable SNMP support
488- Add _lldpd user creation
489- Add initscript
490- New upstream version
491
80530161
VB
492* Mon May 18 2009 Dean Hamstead <dean.hamstead@optusnet.com.au> - 0.3.3-1
493- Initial attempt