]> git.ipfire.org Git - thirdparty/lldpd.git/blame - redhat/lldpd.spec
lldpd: trigger regular interface refresh when changing port ID
[thirdparty/lldpd.git] / redhat / lldpd.spec
CommitLineData
edc4813f 1# configure options
53c653ea 2
2ceb9bb7
VB
3# Define with/without/bcond_without macros (needed for RHEL4)
4%define with() %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}}
5%define bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}
7b166df3 6%define bcond_with() %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}
2ceb9bb7 7
53c653ea 8# Conditional build options, disable with "--without xxx"
c3bab3ed 9%bcond_without xml
53c653ea
PK
10%bcond_without cdp
11%bcond_without edp
12%bcond_without sonmp
13%bcond_without fdp
14%bcond_without lldpmed
15%bcond_without dot1
16%bcond_without dot3
17
d0b88676
VB
18# On RHEL < 5, disable SNMP, Net-SNMP installation seems broken
19%if 0%{?rhel_version} > 0 && 0%{?rhel_version} < 500 || 0%{?centos_version} > 0 && 0%{?centos_version} < 500
7b166df3
VB
20%bcond_with snmp
21%else
22%bcond_without snmp
23%endif
24
edc4813f
VB
25%define lldpd_user _lldpd
26%define lldpd_group _lldpd
27%define lldpd_chroot /var/run/lldpd
28
d623a64a 29Summary: Implementation of IEEE 802.1ab (LLDP)
80530161 30Name: lldpd
412a1dad 31Version: 0.7.8
edc4813f
VB
32Release: 1%{?dist}
33License: MIT
80530161 34Group: System Environment/Daemons
bf74bdaf 35URL: http://vincentbernat.github.com/lldpd/
b2160607 36Source0: http://media.luffy.cx/files/lldpd/%{name}-%{version}.tar.gz
8e555861 37Source1: lldpd.init%{?suse_version:.suse}
26819154 38Source2: lldpd.sysconfig
edc4813f 39
68b375c3 40BuildRequires: pkgconfig
23e7fa38 41BuildRequires: readline-devel
53c653ea 42%if %{with snmp}
edc4813f 43BuildRequires: net-snmp-devel
20ffcb8e 44BuildRequires: openssl-devel
053d9978 45%{!?suse_version:BuildRequires: lm_sensors-devel}
edc4813f 46%endif
c3bab3ed
VB
47%if %{with xml}
48BuildRequires: libxml2-devel
c3bab3ed 49%endif
d623a64a
VB
50%if 0%{?suse_version}
51PreReq: %fillup_prereq %insserv_prereq pwdutils
8e555861 52%else
3336988a 53Requires(pre): /usr/sbin/groupadd /usr/sbin/useradd
8e555861
VB
54Requires(post): chkconfig
55Requires(preun): chkconfig
56Requires(preun): initscripts
57Requires(postun): initscripts
d623a64a 58%endif
80530161
VB
59
60BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
61
80530161 62%description
edc4813f
VB
63This implementation provides LLDP sending and reception, supports VLAN
64and includes an SNMP subagent that can interface to an SNMP agent
65through AgentX protocol.
80530161 66
edc4813f
VB
67LLDP is an industry standard protocol designed to supplant proprietary
68Link-Layer protocols such as Extreme EDP (Extreme Discovery Protocol)
69and CDP (Cisco Discovery Protocol). The goal of LLDP is to provide an
70inter-vendor compatible mechanism to deliver Link-Layer notifications
71to adjacent network devices.
80530161 72
edc4813f
VB
73This daemon is also able to deal with CDP, FDP, SONMP and EDP
74protocol. It also handles LLDP-MED extension.
80530161 75
b2160607
VB
76%package devel
77Summary: Implementation of IEEE 802.1ab - Tools and header files for developers
78Group: Development/Libraries
79Requires: lldpd = %{version}-%{release}
80
81%description devel
82This package is required to develop alternate clients for lldpd.
83
80530161 84%prep
edc4813f 85%setup -q
80530161 86%build
edc4813f 87%configure \
53c653ea 88%if %{with snmp}
edc4813f
VB
89 --with-snmp \
90%endif
c3bab3ed
VB
91%if %{with xml}
92 --with-xml \
93%endif
53c653ea 94%if %{with cdp}
edc4813f
VB
95 --enable-cdp \
96%else
97 --disable-cdp \
98%endif
53c653ea 99%if %{with edp}
edc4813f
VB
100 --enable-edp \
101%else
102 --disable-edp \
103%endif
53c653ea 104%if %{with sonmp}
edc4813f
VB
105 --enable-sonmp \
106%else
107 --disable-sonmp \
108%endif
53c653ea 109%if %{with fdp}
edc4813f
VB
110 --enable-fdp \
111%else
112 --disable-fdp \
113%endif
53c653ea 114%if %{with lldpmed}
edc4813f
VB
115 --enable-lldpmed \
116%else
117 --disable-lldpmed \
118%endif
53c653ea 119%if %{with dot1}
edc4813f
VB
120 --enable-dot1 \
121%else
122 --disable-dot1 \
123%endif
53c653ea 124%if %{with dot3}
edc4813f
VB
125 --enable-dot3 \
126%else
127 --disable-dot3 \
128%endif
129 --with-privsep-user=%lldpd_user \
130 --with-privsep-group=%lldpd_group \
131 --with-privsep-chroot=%lldpd_chroot \
82e23221 132 --with-systemdsystemunitdir=no \
9a4ed64a 133 --prefix=/usr --localstatedir=%{_localstatedir} --sysconfdir=/etc --libdir=%{_libdir} \
fdbe55a6 134 --docdir=%{_docdir}/lldpd
edc4813f 135
45444847 136[ -f /usr/include/net-snmp/agent/struct.h ] || touch src/struct.h
80530161
VB
137make %{?_smp_mflags}
138
139%install
80530161 140make install DESTDIR=$RPM_BUILD_ROOT
edc4813f 141install -d -m770 $RPM_BUILD_ROOT/%lldpd_chroot
8e555861
VB
142install -d $RPM_BUILD_ROOT/%{_initrddir}
143install -m755 %{SOURCE1} $RPM_BUILD_ROOT/%{_initrddir}/lldpd
d623a64a
VB
144%if 0%{?suse_version}
145mkdir -p ${RPM_BUILD_ROOT}/var/adm/fillup-templates
146install -m700 %{SOURCE2} ${RPM_BUILD_ROOT}/var/adm/fillup-templates/sysconfig.lldpd
147%else
3d6585f3 148install -d $RPM_BUILD_ROOT/etc/sysconfig
26819154 149install -m644 %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/lldpd
d623a64a 150%endif
edc4813f
VB
151
152%pre
153# Create lldpd user/group
154if getent group %lldpd_group >/dev/null 2>&1 ; then : ; else \
7b166df3 155 %{_sbindir}/groupadd -r %lldpd_group > /dev/null 2>&1 || exit 1 ; fi
edc4813f 156if getent passwd %lldpd_user >/dev/null 2>&1 ; then : ; else \
7b166df3 157 %{_sbindir}/useradd -g %lldpd_group -M -r -s /bin/false \
edc4813f
VB
158 -c "LLDP daemon" -d %lldpd_chroot %lldpd_user 2> /dev/null \
159 || exit 1 ; fi
80530161 160
d623a64a
VB
161%if 0%{?suse_version}
162# Service management for SuSE
163
3d6585f3 164%post
a5d1ce75 165/sbin/ldconfig
d623a64a
VB
166%{fillup_and_insserv lldpd}
167%postun
a5d1ce75 168/sbin/ldconfig
d623a64a
VB
169%restart_on_update lldpd
170%insserv_cleanup
171%preun
172%stop_on_removal lldpd
3d6585f3 173
d623a64a
VB
174%else
175# Service management for Redhat/Centos
176
177%post
a5d1ce75 178/sbin/ldconfig
d623a64a 179/sbin/chkconfig --add lldpd
3d6585f3 180%postun
a5d1ce75 181/sbin/ldconfig
3d6585f3 182if [ "$1" -ge "1" ]; then
f00bebf6 183 /sbin/service lldpd condrestart >/dev/null 2>&1 || :
3d6585f3 184fi
3d6585f3
VB
185%preun
186if [ "$1" = "0" ]; then
8e555861 187 /sbin/service lldpd stop > /dev/null 2>&1
3d6585f3
VB
188 /sbin/chkconfig --del lldpd
189fi
190
d623a64a
VB
191%endif
192
80530161
VB
193%clean
194rm -rf $RPM_BUILD_ROOT
195
196%files
197%defattr(-,root,root,-)
b2160607
VB
198%dir %{_docdir}/lldpd
199%doc %{_docdir}/lldpd/NEWS
7e431daf 200%doc %{_docdir}/lldpd/ChangeLog
b2160607 201%doc %{_docdir}/lldpd/README.md
03b0a190 202%doc %{_docdir}/lldpd/CONTRIBUTE.md
b2160607
VB
203%{_sbindir}/lldpd
204%{_sbindir}/lldpctl
c84c43ed 205%{_sbindir}/lldpcli
a5d1ce75 206%{_libdir}/liblldpctl.so.*
b2160607 207%doc %{_mandir}/man8/lldp*
3d6585f3 208%dir %attr(750,root,root) %lldpd_chroot
b2160607 209%config %attr(755,root,root) %{_initrddir}/lldpd
d623a64a
VB
210%if 0%{?suse_version}
211%attr(644,root,root) /var/adm/fillup-templates/sysconfig.lldpd
212%else
3d6585f3 213%config(noreplace) /etc/sysconfig/lldpd
d623a64a 214%endif
80530161 215
b2160607
VB
216%files devel
217%defattr(-,root,root)
a5d1ce75
VB
218%{_libdir}/liblldpctl.so
219%{_libdir}/liblldpctl.a
220%{_libdir}/liblldpctl.la
b2160607
VB
221%{_libdir}/pkgconfig/lldpctl.pc
222%{_includedir}/lldpctl.h
223%{_includedir}/lldp-const.h
224
80530161 225%changelog
412a1dad
VB
226* Sun Apr 13 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.8-1
227- New upstream version.
228
d72c2c59
VB
229* Fri Nov 10 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.7-1
230- New upstream version.
231
03b0a190
VB
232* Fri Jul 12 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.6-1
233- New upstream version.
234
444c6862 235* Sat Jun 22 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.5-1
6712d3ec
VB
236- New upstream version.
237
e91ca9d0
VB
238* Sun May 12 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.3-1
239- New upstream version.
240
ef1ae4e7
VB
241* Fri Apr 19 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.2-1
242- New upstream version.
243
a6c894e3
VB
244* Sat Jan 12 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.1-1
245- New upstream version.
246
0eb9ad16
VB
247* Sun Jan 06 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.0-1
248- New upstream version.
249- Requires readline-devel.
250- Ships lldpcli.
251
b2160607
VB
252* Wed Sep 27 2012 Vincent Bernat <bernat@luffy.cx> - 0.6.1-1
253- New upstream version
254- Do not require libevent, use embedded copy.
255- Provide a -devel package.
256
2ceb9bb7
VB
257* Fri Jun 11 2010 Vincent Bernat <bernat@luffy.cx> - 0.5.1-1
258- New upstream version
259- Define bcond_without and with macros if not defined to be compatible
260 with RHEL
8e555861 261- Requires useradd and groupadd
d623a64a 262- Adapt to make it work with SuSE
8e555861 263- Provide an init script targetted at SuSE
053d9978 264- Build require lm_sensors-devel on RHEL
2ceb9bb7 265
c3bab3ed
VB
266* Fri Mar 12 2010 Vincent Bernat <bernat@luffy.cx> - 0.5.0-1
267- New upstream version
268- Add XML support
269
3d6585f3
VB
270* Tue May 19 2009 Vincent Bernat <bernat@luffy.cx> - 0.4.0-1
271- Add variables
272- Enable SNMP support
273- Add _lldpd user creation
274- Add initscript
275- New upstream version
276
80530161
VB
277* Mon May 18 2009 Dean Hamstead <dean.hamstead@optusnet.com.au> - 0.3.3-1
278- Initial attempt