]> git.ipfire.org Git - thirdparty/lldpd.git/blob - redhat/lldpd.spec
doc: new homepage for lldpd
[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. CentOS 5 too.
19 %if 0%{?rhel_version} > 0 && 0%{?rhel_version} < 600 || 0%{?centos_version} > 0 && 0%{?centos_version} < 600
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.0
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(post): chkconfig
54 Requires(preun): chkconfig
55 Requires(preun): initscripts
56 Requires(postun): initscripts
57 %endif
58
59 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
60
61 %description
62 This implementation provides LLDP sending and reception, supports VLAN
63 and includes an SNMP subagent that can interface to an SNMP agent
64 through AgentX protocol.
65
66 LLDP is an industry standard protocol designed to supplant proprietary
67 Link-Layer protocols such as Extreme EDP (Extreme Discovery Protocol)
68 and CDP (Cisco Discovery Protocol). The goal of LLDP is to provide an
69 inter-vendor compatible mechanism to deliver Link-Layer notifications
70 to adjacent network devices.
71
72 This daemon is also able to deal with CDP, FDP, SONMP and EDP
73 protocol. It also handles LLDP-MED extension.
74
75 %package devel
76 Summary: Implementation of IEEE 802.1ab - Tools and header files for developers
77 Group: Development/Libraries
78 Requires: lldpd = %{version}-%{release}
79
80 %description devel
81 This package is required to develop alternate clients for lldpd.
82
83 %prep
84 %setup -q
85 %build
86 %configure \
87 %if %{with snmp}
88 --with-snmp \
89 %endif
90 %if %{with xml}
91 --with-xml \
92 %endif
93 %if %{with cdp}
94 --enable-cdp \
95 %else
96 --disable-cdp \
97 %endif
98 %if %{with edp}
99 --enable-edp \
100 %else
101 --disable-edp \
102 %endif
103 %if %{with sonmp}
104 --enable-sonmp \
105 %else
106 --disable-sonmp \
107 %endif
108 %if %{with fdp}
109 --enable-fdp \
110 %else
111 --disable-fdp \
112 %endif
113 %if %{with lldpmed}
114 --enable-lldpmed \
115 %else
116 --disable-lldpmed \
117 %endif
118 %if %{with dot1}
119 --enable-dot1 \
120 %else
121 --disable-dot1 \
122 %endif
123 %if %{with dot3}
124 --enable-dot3 \
125 %else
126 --disable-dot3 \
127 %endif
128 --with-privsep-user=%lldpd_user \
129 --with-privsep-group=%lldpd_group \
130 --with-privsep-chroot=%lldpd_chroot \
131 --prefix=/usr --localstatedir=%lldpd_chroot --sysconfdir=/etc --libdir=%{_libdir} \
132 --docdir=%{_docdir}/lldpd
133
134 [ -f /usr/include/net-snmp/agent/struct.h ] || touch src/struct.h
135 make %{?_smp_mflags}
136
137 %install
138 make install DESTDIR=$RPM_BUILD_ROOT
139 install -d -m770 $RPM_BUILD_ROOT/%lldpd_chroot
140 install -d $RPM_BUILD_ROOT/%{_initrddir}
141 install -m755 %{SOURCE1} $RPM_BUILD_ROOT/%{_initrddir}/lldpd
142 %if 0%{?suse_version}
143 mkdir -p ${RPM_BUILD_ROOT}/var/adm/fillup-templates
144 install -m700 %{SOURCE2} ${RPM_BUILD_ROOT}/var/adm/fillup-templates/sysconfig.lldpd
145 %else
146 install -d $RPM_BUILD_ROOT/etc/sysconfig
147 install -m644 %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/lldpd
148 %endif
149
150 %pre
151 # Create lldpd user/group
152 if getent group %lldpd_group >/dev/null 2>&1 ; then : ; else \
153 %{_sbindir}/groupadd -r %lldpd_group > /dev/null 2>&1 || exit 1 ; fi
154 if getent passwd %lldpd_user >/dev/null 2>&1 ; then : ; else \
155 %{_sbindir}/useradd -g %lldpd_group -M -r -s /bin/false \
156 -c "LLDP daemon" -d %lldpd_chroot %lldpd_user 2> /dev/null \
157 || exit 1 ; fi
158
159 %if 0%{?suse_version}
160 # Service management for SuSE
161
162 %post
163 /sbin/ldconfig
164 %{fillup_and_insserv lldpd}
165 %postun
166 /sbin/ldconfig
167 %restart_on_update lldpd
168 %insserv_cleanup
169 %preun
170 %stop_on_removal lldpd
171
172 %else
173 # Service management for Redhat/Centos
174
175 %post
176 /sbin/ldconfig
177 /sbin/chkconfig --add lldpd
178 %postun
179 /sbin/ldconfig
180 if [ "$1" -ge "1" ]; then
181 /sbin/service lldpd condrestart >/dev/null 2>&1 || :
182 fi
183 %preun
184 if [ "$1" = "0" ]; then
185 /sbin/service lldpd stop > /dev/null 2>&1
186 /sbin/chkconfig --del lldpd
187 fi
188
189 %endif
190
191 %clean
192 rm -rf $RPM_BUILD_ROOT
193
194 %files
195 %defattr(-,root,root,-)
196 %dir %{_docdir}/lldpd
197 %doc %{_docdir}/lldpd/NEWS
198 %doc %{_docdir}/lldpd/ChangeLog
199 %doc %{_docdir}/lldpd/README.md
200 %{_sbindir}/lldpd
201 %{_sbindir}/lldpctl
202 %{_sbindir}/lldpcli
203 %{_libdir}/liblldpctl.so.*
204 %doc %{_mandir}/man8/lldp*
205 %dir %attr(750,root,root) %lldpd_chroot
206 %config %attr(755,root,root) %{_initrddir}/lldpd
207 %if 0%{?suse_version}
208 %attr(644,root,root) /var/adm/fillup-templates/sysconfig.lldpd
209 %else
210 %config(noreplace) /etc/sysconfig/lldpd
211 %endif
212
213 %files devel
214 %defattr(-,root,root)
215 %{_libdir}/liblldpctl.so
216 %{_libdir}/liblldpctl.a
217 %{_libdir}/liblldpctl.la
218 %{_libdir}/pkgconfig/lldpctl.pc
219 %{_includedir}/lldpctl.h
220 %{_includedir}/lldp-const.h
221
222 %changelog
223 * Sun Jan 06 2013 Vincent Bernat <bernat@luffy.cx> - 0.7.0-1
224 - New upstream version.
225 - Requires readline-devel.
226 - Ships lldpcli.
227
228 * Wed Sep 27 2012 Vincent Bernat <bernat@luffy.cx> - 0.6.1-1
229 - New upstream version
230 - Do not require libevent, use embedded copy.
231 - Provide a -devel package.
232
233 * Fri Jun 11 2010 Vincent Bernat <bernat@luffy.cx> - 0.5.1-1
234 - New upstream version
235 - Define bcond_without and with macros if not defined to be compatible
236 with RHEL
237 - Requires useradd and groupadd
238 - Adapt to make it work with SuSE
239 - Provide an init script targetted at SuSE
240 - Build require lm_sensors-devel on RHEL
241
242 * Fri Mar 12 2010 Vincent Bernat <bernat@luffy.cx> - 0.5.0-1
243 - New upstream version
244 - Add XML support
245
246 * Tue May 19 2009 Vincent Bernat <bernat@luffy.cx> - 0.4.0-1
247 - Add variables
248 - Enable SNMP support
249 - Add _lldpd user creation
250 - Add initscript
251 - New upstream version
252
253 * Mon May 18 2009 Dean Hamstead <dean.hamstead@optusnet.com.au> - 0.3.3-1
254 - Initial attempt