From: Vincent Bernat Date: Tue, 19 May 2009 10:06:58 +0000 (+0200) Subject: Enhance .spec. X-Git-Tag: 0.4.0~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=edc4813f73b5746d76015c59d5d599a2c337b1bb;p=thirdparty%2Flldpd.git Enhance .spec. Enable SNMP support when building RPM. Create lldpd user/group. --- diff --git a/lldpd.spec b/lldpd.spec index 80f75950..461ec40a 100644 --- a/lldpd.spec +++ b/lldpd.spec @@ -1,31 +1,108 @@ +# configure options +%define with_snmp 1 +%define with_cdp 1 +%define with_edp 1 +%define with_sonmp 1 +%define with_fdp 1 +%define with_lldpmed 1 +%define with_dot1 1 +%define with_dot3 1 +%define lldpd_user _lldpd +%define lldpd_group _lldpd +%define lldpd_chroot /var/run/lldpd + Summary: implementation of IEEE 802.1ab (LLDP) Name: lldpd Version: 0.3.3 -Release: 1 -License: BSD Like +Release: 1%{?dist} +License: MIT Group: System Environment/Daemons URL: https://trac.luffy.cx/lldpd/ -Source0: http://www.luffy.cx/lldpd/lldpd-0.3.3.tar.gz +Source0: http://www.luffy.cx/lldpd/%{name}-%{version}.tar.gz + +%if %with_snmp +BuildRequires: net-snmp-devel +Requires: net-snmp +%endif BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %description -This implementation provides LLDP sending and reception, supports VLAN and includes an SNMP subagent that can interface to an SNMP agent through AgentX protocol. +This implementation provides LLDP sending and reception, supports VLAN +and includes an SNMP subagent that can interface to an SNMP agent +through AgentX protocol. -LLDP is an industry standard protocol designed to supplant proprietary Link-Layer protocols such as Extreme's EDP (Extreme Discovery Protocol) and CDP (Cisco Discovery Protocol). The goal of LLDP is to provide an inter-vendor compatible mechanism to deliver Link-Layer notifications to adjacent network devices. +LLDP is an industry standard protocol designed to supplant proprietary +Link-Layer protocols such as Extreme EDP (Extreme Discovery Protocol) +and CDP (Cisco Discovery Protocol). The goal of LLDP is to provide an +inter-vendor compatible mechanism to deliver Link-Layer notifications +to adjacent network devices. -This daemon is also able to deal with CDP, FDP, SONMP and EDP protocol. It also handles LLDP-MED extension. +This daemon is also able to deal with CDP, FDP, SONMP and EDP +protocol. It also handles LLDP-MED extension. %prep -%setup -./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc - +%setup -q %build +%configure \ +%if %with_snmp + --with-snmp \ +%endif +%if %with_cdp + --enable-cdp \ +%else + --disable-cdp \ +%endif +%if %with_edp + --enable-edp \ +%else + --disable-edp \ +%endif +%if %with_sonmp + --enable-sonmp \ +%else + --disable-sonmp \ +%endif +%if %with_fdp + --enable-fdp \ +%else + --disable-fdp \ +%endif +%if %with_lldpmed + --enable-lldpmed \ +%else + --disable-lldpmed \ +%endif +%if %with_dot1 + --enable-dot1 \ +%else + --disable-dot1 \ +%endif +%if %with_dot3 + --enable-dot3 \ +%else + --disable-dot3 \ +%endif + --with-privsep-user=%lldpd_user \ + --with-privsep-group=%lldpd_group \ + --with-privsep-chroot=%lldpd_chroot \ + --prefix=/usr --localstatedir=%lldpd_chroot --sysconfdir=/etc --libdir=%{_libdir} + make %{?_smp_mflags} %install rm -rf $RPM_BUILD_ROOT make install DESTDIR=$RPM_BUILD_ROOT +install -d -m770 $RPM_BUILD_ROOT/%lldpd_chroot + +%pre +# Create lldpd user/group +if getent group %lldpd_group >/dev/null 2>&1 ; then : ; else \ + /usr/sbin/groupadd -r %lldpd_group > /dev/null 2>&1 || exit 1 ; fi +if getent passwd %lldpd_user >/dev/null 2>&1 ; then : ; else \ + /usr/sbin/useradd -g %lldpd_group -M -r -s /bin/false \ + -c "LLDP daemon" -d %lldpd_chroot %lldpd_user 2> /dev/null \ + || exit 1 ; fi %clean rm -rf $RPM_BUILD_ROOT