]> git.ipfire.org Git - thirdparty/lldpd.git/blob - redhat/lldpd.spec
build: provide a sysusers.d file
[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.10
32 Release: 1%{?dist}
33 License: MIT
34 Group: System Environment/Daemons
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
79 Requires: lldpd = %{version}-%{release}
80
81 %description devel
82 This package is required to develop alternate clients for lldpd.
83
84 %prep
85 %setup -q
86 %build
87 %configure \
88 %if %{with snmp}
89 --with-snmp \
90 %endif
91 %if %{with xml}
92 --with-xml \
93 %endif
94 %if %{with cdp}
95 --enable-cdp \
96 %else
97 --disable-cdp \
98 %endif
99 %if %{with edp}
100 --enable-edp \
101 %else
102 --disable-edp \
103 %endif
104 %if %{with sonmp}
105 --enable-sonmp \
106 %else
107 --disable-sonmp \
108 %endif
109 %if %{with fdp}
110 --enable-fdp \
111 %else
112 --disable-fdp \
113 %endif
114 %if %{with lldpmed}
115 --enable-lldpmed \
116 %else
117 --disable-lldpmed \
118 %endif
119 %if %{with dot1}
120 --enable-dot1 \
121 %else
122 --disable-dot1 \
123 %endif
124 %if %{with dot3}
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 \
132 --with-systemdsystemunitdir=no \
133 --with-sysusersdir=no \
134 --prefix=/usr --localstatedir=%{_localstatedir} --sysconfdir=/etc --libdir=%{_libdir} \
135 --docdir=%{_docdir}/lldpd
136
137 [ -f /usr/include/net-snmp/agent/struct.h ] || touch src/struct.h
138 make %{?_smp_mflags}
139
140 %install
141 make install DESTDIR=$RPM_BUILD_ROOT
142 install -d -m770 $RPM_BUILD_ROOT/%lldpd_chroot
143 install -d $RPM_BUILD_ROOT/%{_initrddir}
144 install -m755 %{SOURCE1} $RPM_BUILD_ROOT/%{_initrddir}/lldpd
145 %if 0%{?suse_version}
146 mkdir -p ${RPM_BUILD_ROOT}/var/adm/fillup-templates
147 install -m700 %{SOURCE2} ${RPM_BUILD_ROOT}/var/adm/fillup-templates/sysconfig.lldpd
148 %else
149 install -d $RPM_BUILD_ROOT/etc/sysconfig
150 install -m644 %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/lldpd
151 %endif
152
153 %pre
154 # Create lldpd user/group
155 if getent group %lldpd_group >/dev/null 2>&1 ; then : ; else \
156 %{_sbindir}/groupadd -r %lldpd_group > /dev/null 2>&1 || exit 1 ; fi
157 if getent passwd %lldpd_user >/dev/null 2>&1 ; then : ; else \
158 %{_sbindir}/useradd -g %lldpd_group -M -r -s /bin/false \
159 -c "LLDP daemon" -d %lldpd_chroot %lldpd_user 2> /dev/null \
160 || exit 1 ; fi
161
162 %if 0%{?suse_version}
163 # Service management for SuSE
164
165 %post
166 /sbin/ldconfig
167 %{fillup_and_insserv lldpd}
168 %postun
169 /sbin/ldconfig
170 %restart_on_update lldpd
171 %insserv_cleanup
172 %preun
173 %stop_on_removal lldpd
174
175 %else
176 # Service management for Redhat/Centos
177
178 %post
179 /sbin/ldconfig
180 /sbin/chkconfig --add lldpd
181 %postun
182 /sbin/ldconfig
183 if [ "$1" -ge "1" ]; then
184 /sbin/service lldpd condrestart >/dev/null 2>&1 || :
185 fi
186 %preun
187 if [ "$1" = "0" ]; then
188 /sbin/service lldpd stop > /dev/null 2>&1
189 /sbin/chkconfig --del lldpd
190 fi
191
192 %endif
193
194 %clean
195 rm -rf $RPM_BUILD_ROOT
196
197 %files
198 %defattr(-,root,root,-)
199 %dir %{_docdir}/lldpd
200 %doc %{_docdir}/lldpd/NEWS
201 %doc %{_docdir}/lldpd/ChangeLog
202 %doc %{_docdir}/lldpd/README.md
203 %doc %{_docdir}/lldpd/CONTRIBUTE.md
204 %{_sbindir}/lldpd
205 %{_sbindir}/lldpctl
206 %{_sbindir}/lldpcli
207 %{_libdir}/liblldpctl.so.*
208 %doc %{_mandir}/man8/lldp*
209 %dir %attr(750,root,root) %lldpd_chroot
210 %config %attr(755,root,root) %{_initrddir}/lldpd
211 %if 0%{?suse_version}
212 %attr(644,root,root) /var/adm/fillup-templates/sysconfig.lldpd
213 %else
214 %config(noreplace) /etc/sysconfig/lldpd
215 %endif
216
217 %files devel
218 %defattr(-,root,root)
219 %{_libdir}/liblldpctl.so
220 %{_libdir}/liblldpctl.a
221 %{_libdir}/liblldpctl.la
222 %{_libdir}/pkgconfig/lldpctl.pc
223 %{_includedir}/lldpctl.h
224 %{_includedir}/lldp-const.h
225
226 %changelog
227 * Mon Jul 21 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.10-1
228 - New upstream version.
229
230 * Wed May 28 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.9-1
231 - New upstream version.
232
233 * Sun Apr 13 2014 Vincent Bernat <bernat@luffy.cx> - 0.7.8-1
234 - New upstream version.
235
236 * Fri Nov 10 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.7-1
237 - New upstream version.
238
239 * Fri Jul 12 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.6-1
240 - New upstream version.
241
242 * Sat Jun 22 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.5-1
243 - New upstream version.
244
245 * Sun May 12 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.3-1
246 - New upstream version.
247
248 * Fri Apr 19 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.2-1
249 - New upstream version.
250
251 * Sat Jan 12 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.1-1
252 - New upstream version.
253
254 * Sun Jan 06 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.0-1
255 - New upstream version.
256 - Requires readline-devel.
257 - Ships lldpcli.
258
259 * Wed Sep 27 2012 Vincent Bernat <bernat@luffy.cx> - 0.6.1-1
260 - New upstream version
261 - Do not require libevent, use embedded copy.
262 - Provide a -devel package.
263
264 * Fri Jun 11 2010 Vincent Bernat <bernat@luffy.cx> - 0.5.1-1
265 - New upstream version
266 - Define bcond_without and with macros if not defined to be compatible
267 with RHEL
268 - Requires useradd and groupadd
269 - Adapt to make it work with SuSE
270 - Provide an init script targetted at SuSE
271 - Build require lm_sensors-devel on RHEL
272
273 * Fri Mar 12 2010 Vincent Bernat <bernat@luffy.cx> - 0.5.0-1
274 - New upstream version
275 - Add XML support
276
277 * Tue May 19 2009 Vincent Bernat <bernat@luffy.cx> - 0.4.0-1
278 - Add variables
279 - Enable SNMP support
280 - Add _lldpd user creation
281 - Add initscript
282 - New upstream version
283
284 * Mon May 18 2009 Dean Hamstead <dean.hamstead@optusnet.com.au> - 0.3.3-1
285 - Initial attempt