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