]>
Commit | Line | Data |
---|---|---|
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}} | |
6cefe733 | 5 | %define without() %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}} |
7b166df3 | 6 | %define bcond_with() %{expand:%%{?_with_%{1}:%%global with_%{1} 1}} |
6cefe733 | 7 | %define bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}} |
2ceb9bb7 | 8 | |
53c653ea | 9 | # Conditional build options, disable with "--without xxx" |
c3bab3ed | 10 | %bcond_without xml |
53c653ea PK |
11 | %bcond_without cdp |
12 | %bcond_without edp | |
13 | %bcond_without sonmp | |
14 | %bcond_without fdp | |
15 | %bcond_without lldpmed | |
16 | %bcond_without dot1 | |
17 | %bcond_without dot3 | |
fb1b78bb | 18 | %bcond_without custom |
441d53f9 | 19 | %bcond_with json |
53c653ea | 20 | |
d0b88676 VB |
21 | # On RHEL < 5, disable SNMP, Net-SNMP installation seems broken |
22 | %if 0%{?rhel_version} > 0 && 0%{?rhel_version} < 500 || 0%{?centos_version} > 0 && 0%{?centos_version} < 500 | |
7b166df3 VB |
23 | %bcond_with snmp |
24 | %else | |
25 | %bcond_without snmp | |
26 | %endif | |
27 | ||
780e843d | 28 | # On RHEL <= 6, compile with oldies |
f7ce4668 | 29 | # For SuSE, SLE11 with a recent SP comes with 3.0. SLE12 comes with 3.12. |
780e843d | 30 | %if 0%{?rhel_version} > 0 && 0%{?rhel_version} < 700 || 0%{?centos_version} > 0 && 0%{?centos_version} < 700 |
5d81ecdd VB |
31 | %bcond_without oldies |
32 | %else | |
33 | %bcond_with oldies | |
34 | %endif | |
35 | ||
6cefe733 | 36 | # On RHEL < 7, disable systemd |
f7ce4668 VB |
37 | # On SuSE < 12, disable systemd |
38 | %if 0%{?rhel_version} > 0 && 0%{?rhel_version} < 700 || 0%{?centos_version} > 0 && 0%{?centos_version} < 700 || 0%{?suse_version} > 0 && 0%{?suse_version} < 1200 | |
6cefe733 VB |
39 | %bcond_with systemd |
40 | %else | |
41 | %bcond_without systemd | |
42 | %endif | |
43 | ||
3637cb7a VB |
44 | # On RHEL < 7, use embedded libevent |
45 | %if 0%{?rhel_version} > 0 && 0%{?rhel_version} < 700 || 0%{?centos_version} > 0 && 0%{?centos_version} < 700 || 0%{?suse_version} > 0 && 0%{?suse_version} < 1200 | |
46 | %bcond_with system_libevent | |
47 | %else | |
48 | %bcond_without system_libevent | |
49 | %endif | |
50 | ||
fa12cb8f VB |
51 | # On RHEL < 6, use embedded libnl |
52 | %if 0%{?rhel_version} > 0 && 0%{?rhel_version} < 600 || 0%{?centos_version} > 0 && 0%{?centos_version} < 600 || 0%{?suse_version} > 0 && 0%{?suse_version} < 1200 | |
53 | %bcond_with system_libnl | |
54 | %else | |
55 | %bcond_without system_libnl | |
56 | %endif | |
57 | ||
edc4813f VB |
58 | %define lldpd_user _lldpd |
59 | %define lldpd_group _lldpd | |
60 | %define lldpd_chroot /var/run/lldpd | |
61 | ||
d623a64a | 62 | Summary: Implementation of IEEE 802.1ab (LLDP) |
80530161 | 63 | Name: lldpd |
2145c7cf | 64 | Version: 0.8.0 |
edc4813f VB |
65 | Release: 1%{?dist} |
66 | License: MIT | |
2e441b24 | 67 | Group: System/Management |
bf74bdaf | 68 | URL: http://vincentbernat.github.com/lldpd/ |
70943e34 | 69 | Source0: http://media.luffy.cx/files/lldpd/%{name}-%{version}.tar.gz |
8e555861 | 70 | Source1: lldpd.init%{?suse_version:.suse} |
26819154 | 71 | Source2: lldpd.sysconfig |
edc4813f | 72 | |
68b375c3 | 73 | BuildRequires: pkgconfig |
3637cb7a | 74 | %if %{with system_libevent} |
2145c7cf | 75 | BuildRequires: libevent-devel |
3637cb7a | 76 | %endif |
fa12cb8f VB |
77 | %if %{with system_libnl} |
78 | BuildRequires: libnl3-devel | |
79 | %endif | |
23e7fa38 | 80 | BuildRequires: readline-devel |
53c653ea | 81 | %if %{with snmp} |
edc4813f | 82 | BuildRequires: net-snmp-devel |
20ffcb8e | 83 | BuildRequires: openssl-devel |
053d9978 | 84 | %{!?suse_version:BuildRequires: lm_sensors-devel} |
edc4813f | 85 | %endif |
c3bab3ed VB |
86 | %if %{with xml} |
87 | BuildRequires: libxml2-devel | |
c3bab3ed | 88 | %endif |
3250e17b VB |
89 | %if %{with json} |
90 | BuildRequires: json-c-devel | |
91 | %endif | |
6cefe733 VB |
92 | %if %{with systemd} |
93 | Requires(post): systemd | |
94 | Requires(preun): systemd | |
95 | Requires(postun): systemd | |
96 | BuildRequires: systemd | |
97 | BuildRequires: systemd-units | |
98 | %endif | |
d623a64a VB |
99 | %if 0%{?suse_version} |
100 | PreReq: %fillup_prereq %insserv_prereq pwdutils | |
8e555861 | 101 | %else |
3336988a | 102 | Requires(pre): /usr/sbin/groupadd /usr/sbin/useradd |
8e555861 VB |
103 | Requires(post): chkconfig |
104 | Requires(preun): chkconfig | |
105 | Requires(preun): initscripts | |
106 | Requires(postun): initscripts | |
d623a64a | 107 | %endif |
80530161 | 108 | |
5592bec9 | 109 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release} |
80530161 | 110 | |
80530161 | 111 | %description |
edc4813f VB |
112 | This implementation provides LLDP sending and reception, supports VLAN |
113 | and includes an SNMP subagent that can interface to an SNMP agent | |
114 | through AgentX protocol. | |
80530161 | 115 | |
edc4813f VB |
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. | |
80530161 | 121 | |
edc4813f VB |
122 | This daemon is also able to deal with CDP, FDP, SONMP and EDP |
123 | protocol. It also handles LLDP-MED extension. | |
80530161 | 124 | |
b2160607 VB |
125 | %package devel |
126 | Summary: Implementation of IEEE 802.1ab - Tools and header files for developers | |
2e441b24 | 127 | Group: Development/Libraries/C |
fae46e61 | 128 | BuildRequires: pkgconfig |
b2160607 VB |
129 | Requires: lldpd = %{version}-%{release} |
130 | ||
131 | %description devel | |
132 | This package is required to develop alternate clients for lldpd. | |
133 | ||
b5b304e8 VB |
134 | LLDP is an industry standard protocol designed to supplant proprietary |
135 | Link-Layer protocols such as Extreme EDP (Extreme Discovery Protocol) | |
136 | and CDP (Cisco Discovery Protocol). The goal of LLDP is to provide an | |
137 | inter-vendor compatible mechanism to deliver Link-Layer notifications | |
138 | to adjacent network devices. | |
139 | ||
80530161 | 140 | %prep |
edc4813f | 141 | %setup -q |
80530161 | 142 | %build |
edc4813f | 143 | %configure \ |
53c653ea | 144 | %if %{with snmp} |
edc4813f VB |
145 | --with-snmp \ |
146 | %endif | |
c3bab3ed VB |
147 | %if %{with xml} |
148 | --with-xml \ | |
149 | %endif | |
53c653ea | 150 | %if %{with cdp} |
edc4813f VB |
151 | --enable-cdp \ |
152 | %else | |
153 | --disable-cdp \ | |
154 | %endif | |
53c653ea | 155 | %if %{with edp} |
edc4813f VB |
156 | --enable-edp \ |
157 | %else | |
158 | --disable-edp \ | |
159 | %endif | |
53c653ea | 160 | %if %{with sonmp} |
edc4813f VB |
161 | --enable-sonmp \ |
162 | %else | |
163 | --disable-sonmp \ | |
164 | %endif | |
53c653ea | 165 | %if %{with fdp} |
edc4813f VB |
166 | --enable-fdp \ |
167 | %else | |
168 | --disable-fdp \ | |
169 | %endif | |
53c653ea | 170 | %if %{with lldpmed} |
edc4813f VB |
171 | --enable-lldpmed \ |
172 | %else | |
173 | --disable-lldpmed \ | |
174 | %endif | |
53c653ea | 175 | %if %{with dot1} |
edc4813f VB |
176 | --enable-dot1 \ |
177 | %else | |
178 | --disable-dot1 \ | |
179 | %endif | |
53c653ea | 180 | %if %{with dot3} |
edc4813f VB |
181 | --enable-dot3 \ |
182 | %else | |
183 | --disable-dot3 \ | |
fb1b78bb AA |
184 | %endif |
185 | %if %{with custom} | |
186 | --enable-custom \ | |
187 | %else | |
188 | --disable-custom \ | |
5d81ecdd VB |
189 | %endif |
190 | %if %{with oldies} | |
191 | --enable-oldies \ | |
192 | %else | |
193 | --disable-oldies \ | |
edc4813f VB |
194 | %endif |
195 | --with-privsep-user=%lldpd_user \ | |
196 | --with-privsep-group=%lldpd_group \ | |
197 | --with-privsep-chroot=%lldpd_chroot \ | |
6cefe733 | 198 | %if %{without systemd} |
82e23221 | 199 | --with-systemdsystemunitdir=no \ |
6cefe733 | 200 | %endif |
a9f77488 | 201 | --with-sysusersdir=no \ |
5cffb4e7 VB |
202 | --prefix=%{_usr} \ |
203 | --localstatedir=%{_localstatedir} \ | |
204 | --sysconfdir=%{_sysconfdir} \ | |
205 | --libdir=%{_libdir} \ | |
fdbe55a6 | 206 | --docdir=%{_docdir}/lldpd |
edc4813f | 207 | |
5cffb4e7 | 208 | [ -f %{_includedir}/net-snmp/agent/struct.h ] || touch src/struct.h |
80530161 VB |
209 | make %{?_smp_mflags} |
210 | ||
211 | %install | |
80530161 | 212 | make install DESTDIR=$RPM_BUILD_ROOT |
6cefe733 | 213 | %if %{without systemd} |
8e555861 VB |
214 | install -d $RPM_BUILD_ROOT/%{_initrddir} |
215 | install -m755 %{SOURCE1} $RPM_BUILD_ROOT/%{_initrddir}/lldpd | |
6cefe733 | 216 | %endif |
d623a64a VB |
217 | %if 0%{?suse_version} |
218 | mkdir -p ${RPM_BUILD_ROOT}/var/adm/fillup-templates | |
219 | install -m700 %{SOURCE2} ${RPM_BUILD_ROOT}/var/adm/fillup-templates/sysconfig.lldpd | |
220 | %else | |
3d6585f3 | 221 | install -d $RPM_BUILD_ROOT/etc/sysconfig |
26819154 | 222 | install -m644 %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/lldpd |
d623a64a | 223 | %endif |
edc4813f VB |
224 | |
225 | %pre | |
226 | # Create lldpd user/group | |
227 | if getent group %lldpd_group >/dev/null 2>&1 ; then : ; else \ | |
7b166df3 | 228 | %{_sbindir}/groupadd -r %lldpd_group > /dev/null 2>&1 || exit 1 ; fi |
edc4813f | 229 | if getent passwd %lldpd_user >/dev/null 2>&1 ; then : ; else \ |
14da0d3c | 230 | %{_sbindir}/useradd -g %lldpd_group -M -r -s /sbin/nologin \ |
edc4813f VB |
231 | -c "LLDP daemon" -d %lldpd_chroot %lldpd_user 2> /dev/null \ |
232 | || exit 1 ; fi | |
80530161 | 233 | |
d623a64a VB |
234 | %if 0%{?suse_version} |
235 | # Service management for SuSE | |
236 | ||
3d6585f3 | 237 | %post |
a5d1ce75 | 238 | /sbin/ldconfig |
d623a64a VB |
239 | %{fillup_and_insserv lldpd} |
240 | %postun | |
a5d1ce75 | 241 | /sbin/ldconfig |
d623a64a VB |
242 | %restart_on_update lldpd |
243 | %insserv_cleanup | |
244 | %preun | |
245 | %stop_on_removal lldpd | |
3d6585f3 | 246 | |
6cefe733 VB |
247 | %elseif %{without systemd} |
248 | # Service management for Redhat/CentOS without systemd | |
d623a64a VB |
249 | |
250 | %post | |
a5d1ce75 | 251 | /sbin/ldconfig |
d623a64a | 252 | /sbin/chkconfig --add lldpd |
3d6585f3 | 253 | %postun |
a5d1ce75 | 254 | /sbin/ldconfig |
3d6585f3 | 255 | if [ "$1" -ge "1" ]; then |
f00bebf6 | 256 | /sbin/service lldpd condrestart >/dev/null 2>&1 || : |
3d6585f3 | 257 | fi |
3d6585f3 VB |
258 | %preun |
259 | if [ "$1" = "0" ]; then | |
8e555861 | 260 | /sbin/service lldpd stop > /dev/null 2>&1 |
3d6585f3 VB |
261 | /sbin/chkconfig --del lldpd |
262 | fi | |
263 | ||
6cefe733 VB |
264 | %else |
265 | # Service management for Redhat/CentOS with systemd | |
266 | ||
267 | %post | |
268 | /sbin/ldconfig | |
269 | %systemd_post lldpd.service | |
270 | ||
271 | %preun | |
272 | %systemd_preun lldpd.service | |
273 | ||
274 | %postun | |
275 | %systemd_postun_with_restart lldpd.service | |
276 | /sbin/ldconfig | |
277 | ||
d623a64a VB |
278 | %endif |
279 | ||
80530161 VB |
280 | %clean |
281 | rm -rf $RPM_BUILD_ROOT | |
282 | ||
283 | %files | |
284 | %defattr(-,root,root,-) | |
b2160607 VB |
285 | %dir %{_docdir}/lldpd |
286 | %doc %{_docdir}/lldpd/NEWS | |
7e431daf | 287 | %doc %{_docdir}/lldpd/ChangeLog |
b2160607 | 288 | %doc %{_docdir}/lldpd/README.md |
03b0a190 | 289 | %doc %{_docdir}/lldpd/CONTRIBUTE.md |
b2160607 VB |
290 | %{_sbindir}/lldpd |
291 | %{_sbindir}/lldpctl | |
c84c43ed | 292 | %{_sbindir}/lldpcli |
a5d1ce75 | 293 | %{_libdir}/liblldpctl.so.* |
4ed3c3d8 | 294 | %{_datadir}/zsh |
98bf70e3 | 295 | %{_datadir}/bash-completion |
b2160607 | 296 | %doc %{_mandir}/man8/lldp* |
c0e428ac | 297 | %config %{_sysconfdir}/lldpd.d |
6cefe733 | 298 | %if %{without systemd} |
b2160607 | 299 | %config %attr(755,root,root) %{_initrddir}/lldpd |
6cefe733 VB |
300 | %else |
301 | %{_unitdir}/lldpd.service | |
302 | %endif | |
d623a64a | 303 | %if 0%{?suse_version} |
5cffb4e7 | 304 | %attr(644,root,root) %{_var}/adm/fillup-templates/sysconfig.lldpd |
d623a64a | 305 | %else |
5cffb4e7 | 306 | %config(noreplace) %{_sysconfdir}/sysconfig/lldpd |
d623a64a | 307 | %endif |
80530161 | 308 | |
b2160607 VB |
309 | %files devel |
310 | %defattr(-,root,root) | |
a5d1ce75 VB |
311 | %{_libdir}/liblldpctl.so |
312 | %{_libdir}/liblldpctl.a | |
313 | %{_libdir}/liblldpctl.la | |
b2160607 VB |
314 | %{_libdir}/pkgconfig/lldpctl.pc |
315 | %{_includedir}/lldpctl.h | |
316 | %{_includedir}/lldp-const.h | |
317 | ||
80530161 | 318 | %changelog |
2145c7cf VB |
319 | * Sun Nov 22 2015 Vincent Bernat <bernat@luffy.cx> - 0.8.0-1 |
320 | - New upstream version. | |
fa12cb8f | 321 | - Use system libnl3 when possible. |
3637cb7a | 322 | - Use system libevent when possible. |
2145c7cf | 323 | |
8e89804d VB |
324 | * Wed Sep 09 2015 Vincent Bernat <bernat@luffy.cx> - 0.7.17-1 |
325 | - New upstream version. | |
326 | ||
96a1dec9 VB |
327 | * Fri Aug 07 2015 Vincent Bernat <bernat@luffy.cx> - 0.7.16-1 |
328 | - New upstream version. | |
329 | ||
b896513b VB |
330 | * Wed May 20 2015 Vincent Bernat <bernat@luffy.cx> - 0.7.15-1 |
331 | - New upstream version. | |
332 | ||
8de206fd VB |
333 | * Sat Apr 04 2015 Vincent Bernat <bernat@luffy.cx> - 0.7.14-1 |
334 | - New upstream version. | |
335 | ||
2216fdf1 | 336 | * Tue Dec 30 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.13-1 |
d9cf6428 VB |
337 | - New upstream version. |
338 | ||
2216fdf1 | 339 | * Sat Nov 22 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.12-1 |
0882639d VB |
340 | - New upstream version. |
341 | - Completion for bash and zsh. | |
342 | ||
62446808 VB |
343 | * Wed Oct 08 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.11-1 |
344 | - New upstream version. | |
e202ae37 | 345 | - Completion for bash and zsh. |
62446808 | 346 | |
3620ee09 VB |
347 | * Mon Jul 21 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.10-1 |
348 | - New upstream version. | |
349 | ||
70943e34 VB |
350 | * Wed May 28 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.9-1 |
351 | - New upstream version. | |
352 | ||
412a1dad VB |
353 | * Sun Apr 13 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.8-1 |
354 | - New upstream version. | |
355 | ||
e537ab77 | 356 | * Sun Nov 10 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.7-1 |
d72c2c59 VB |
357 | - New upstream version. |
358 | ||
03b0a190 VB |
359 | * Fri Jul 12 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.6-1 |
360 | - New upstream version. | |
361 | ||
444c6862 | 362 | * Sat Jun 22 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.5-1 |
6712d3ec VB |
363 | - New upstream version. |
364 | ||
e91ca9d0 VB |
365 | * Sun May 12 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.3-1 |
366 | - New upstream version. | |
367 | ||
ef1ae4e7 VB |
368 | * Fri Apr 19 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.2-1 |
369 | - New upstream version. | |
370 | ||
a6c894e3 VB |
371 | * Sat Jan 12 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.1-1 |
372 | - New upstream version. | |
373 | ||
0eb9ad16 VB |
374 | * Sun Jan 06 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.0-1 |
375 | - New upstream version. | |
376 | - Requires readline-devel. | |
377 | - Ships lldpcli. | |
378 | ||
e537ab77 | 379 | * Thu Sep 27 2012 Vincent Bernat <bernat@luffy.cx> - 0.6.1-1 |
b2160607 VB |
380 | - New upstream version |
381 | - Do not require libevent, use embedded copy. | |
382 | - Provide a -devel package. | |
383 | ||
2ceb9bb7 VB |
384 | * Fri Jun 11 2010 Vincent Bernat <bernat@luffy.cx> - 0.5.1-1 |
385 | - New upstream version | |
386 | - Define bcond_without and with macros if not defined to be compatible | |
387 | with RHEL | |
8e555861 | 388 | - Requires useradd and groupadd |
d623a64a | 389 | - Adapt to make it work with SuSE |
8e555861 | 390 | - Provide an init script targetted at SuSE |
053d9978 | 391 | - Build require lm_sensors-devel on RHEL |
2ceb9bb7 | 392 | |
c3bab3ed VB |
393 | * Fri Mar 12 2010 Vincent Bernat <bernat@luffy.cx> - 0.5.0-1 |
394 | - New upstream version | |
395 | - Add XML support | |
396 | ||
3d6585f3 VB |
397 | * Tue May 19 2009 Vincent Bernat <bernat@luffy.cx> - 0.4.0-1 |
398 | - Add variables | |
399 | - Enable SNMP support | |
400 | - Add _lldpd user creation | |
401 | - Add initscript | |
402 | - New upstream version | |
403 | ||
80530161 VB |
404 | * Mon May 18 2009 Dean Hamstead <dean.hamstead@optusnet.com.au> - 0.3.3-1 |
405 | - Initial attempt |