Name:           lldpad 
Version:        @VERSION@
Release:        1%{?dist}
Summary:        Intel LLDP Agent

Group:          System Environment/Daemons
License:        GPLv2
URL:            http://e1000.sourceforge.net
Source0:        http://downloads.sourceforge.net/e1000/%{name}-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

# BuildRequires:  
Requires(post):   @SPEC_BUILD_REQUIRES_POST@
Requires(preun):  @SPEC_BUILD_REQUIRES_PREUN@
Requires(postun): @SPEC_BUILD_REQUIRES_POSTUN@

%description
This package contains the Linux user space daemon and configuration tool for
Intel LLDP Agent with Enhanced Ethernet support for the Data Center.

%package        devel
Summary:        Development files for %{name}
Group:          Development/Libraries
Requires:       %{name} = %{version}-%{release}

%description    devel
The %{name}-devel package contains header files for developing applications
that use %{name}.

%prep
%setup -q


%build
%configure
make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT


%clean
rm -rf $RPM_BUILD_ROOT


%post
if [ -e /etc/init.d/%{name} ] && [ -e /sbin/chkconfig ]; then
	/sbin/chkconfig --add %{name}
fi
if type systemctl >/dev/null 2>&1; then
	# Scriplet only runs preset. Run enable/start manually
	%systemd_post %{name}.socket %{name}.service
fi

%preun
if [ $1 = 0 ]; then
	if [ -e /etc/init.d/%{name} ] && [ -e /sbin/chkconfig ]; then
		/sbin/service %{name} stop
		/sbin/chkconfig --del %{name}
	fi
	if type systemctl >/dev/null 2>&1; then
		%systemd_preun %{name}.service %{name}.socket
	fi
fi

%postun
if [ $1 = 1 ]; then
	# Package upgrade, not uninstall
	if [ -e /etc/init.d/%{name} ] && [ -e /sbin/chkconfig ]; then
		/sbin/service %{name} condrestart
	fi
	if type systemctl >/dev/null 2>&1; then
		%systemd_postun_with_restart %{name}.socket %{name}.service
	fi
fi

%files
%defattr(-,root,root,-)
%doc COPYING
%doc README
%doc ChangeLog
%{_sbindir}/*
%dir /var/lib/lldpad
@SPEC_FILE_LLDPAD_SERVICE@
@SPEC_FILE_LLDPAD_SOCKET@
%{_sysconfdir}/bash_completion.d/lldpad
%{_sysconfdir}/bash_completion.d/lldptool
%{_mandir}/man8/*
%{_libdir}/liblldp_clif.*
%{_mandir}/man3/liblldp_clif-vdp22.*

%files devel
%defattr(-,root,root,-)
%doc COPYING
%doc README
%{_includedir}/*
%{_libdir}/pkgconfig/*.pc


%changelog
* Mon Feb 22 2010 John Fastabend <john.r.fastabend@intel.com> - 0.9.22
- initial generic lldp support
* Thu Feb 26 2009 Chris Leech <christopher.leech@intel.com> - 0.9.5-1
- initial RPM packaging

