jridky / rpms / lldpd

Forked from rpms/lldpd 3 years ago
Clone

Blame lldpd.spec

a026e25
%if 0%{?el6}
a026e25
%bcond_with systemd
a026e25
%global rundir /var/run/
a026e25
%else
a026e25
%bcond_without systemd
a026e25
%global rundir /run/
a026e25
%endif
13ff482
13ff482
%global gh_owner vincentbernat
13ff482
13ff482
Name:     lldpd
13ff482
Version:  0.9.7
Igor Gnatenko b702b8b
Release:  8%{?dist}
13ff482
Summary:  ISC-licensed implementation of LLDP
13ff482
13ff482
License:  ISC
13ff482
URL:      https://%{gh_owner}.github.io/%{name}/
7fc6e67
Source0:  https://media.luffy.cx/files/lldpd/lldpd-%{version}.tar.gz
13ff482
Source1:  %{name}-fedora.service
13ff482
Source2:  %{name}-tmpfiles
7fc6e67
Source3:  %{name}-fedora.sysconfig
a026e25
Source4:  %{name}-el6.init
1781f65
Source5:  %{name}-el7.service
13ff482
13ff482
BuildRequires: readline-devel
13ff482
BuildRequires: check-devel
13ff482
BuildRequires: net-snmp-devel
13ff482
BuildRequires: libxml2-devel
a026e25
# EL6 needs libevent2 as the package
a026e25
%if 0%{?el6}
a026e25
BuildRequires: libevent2-devel
a026e25
%else
a026e25
BuildRequires: libevent-devel
a026e25
%endif
13ff482
a026e25
%if 0%{?with_systemd}
13ff482
# For systemd stuff
13ff482
BuildRequires: systemd
13ff482
%{?systemd_requires}
a026e25
%else
a026e25
Requires(post): chkconfig
a026e25
Requires(preun): chkconfig
a026e25
# This is for /sbin/service
a026e25
Requires(preun): initscripts
a026e25
%endif
13ff482
13ff482
Requires(pre): shadow-utils
13ff482
13ff482
%description
13ff482
LLDP is an industry standard protocol designed to supplant proprietary
13ff482
Link-Layer protocols such as EDP or CDP. The goal of LLDP is to provide
13ff482
an inter-vendor compatible mechanism to deliver Link-Layer notifications
13ff482
to adjacent network devices.
13ff482
13ff482
%package devel
13ff482
Requires: %{name}%{?_isa} = %{version}-%{release}
13ff482
Summary: %{summary}
13ff482
13ff482
%description devel
13ff482
%{name} development libraries and headers
13ff482
13ff482
%prep
13ff482
%autosetup
13ff482
13ff482
13ff482
%build
13ff482
%configure --disable-static --with-snmp --disable-silent-rules \
13ff482
  --with-privsep-user=%{name} --with-privsep-group=%{name} \
a026e25
  --with-privsep-chroot=%{rundir}%{name}/chroot \
a026e25
  --with-lldpd-ctl-socket=%{rundir}%{name}/%{name}.socket \
a026e25
%if 0%{?with_systemd}
a026e25
  --with-systemdsystemunitdir=%{_unitdir} --with-sysusersdir=no
a026e25
%endif
13ff482
13ff482
make %{?_smp_mflags}
13ff482
13ff482
13ff482
%install
13ff482
%make_install
13ff482
a026e25
%if 0%{?with_systemd}
dfc2385
%if 0%{?fedora} >= 26
13ff482
install -p -D -m644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
1781f65
%else
1781f65
install -p -D -m644 %{SOURCE5} %{buildroot}%{_unitdir}/%{name}.service
1781f65
%endif
13ff482
install -p -D -m644 %{SOURCE2} %{buildroot}%{_tmpfilesdir}/%{name}.conf
a026e25
%else
a026e25
install -p -D -m755 %{SOURCE4} %{buildroot}%{_initddir}/%{name}
a026e25
%endif
7fc6e67
install -p -D -m644 %{SOURCE3} %{buildroot}/etc/sysconfig/%{name}
a026e25
a026e25
install -d -D -m 0755 %{buildroot}%{rundir}%{name}/chroot
13ff482
install -d -m 0755 %{buildroot}%{_sharedstatedir}/%{name}
13ff482
# remove the docs from buildroot
13ff482
rm -rf %{buildroot}/usr/share/doc/%{name}
13ff482
13ff482
13ff482
# don't include completion conf yet
13ff482
rm -f %{buildroot}/usr/share/bash-completion/completions/lldpcli
13ff482
rm -f %{buildroot}/usr/share/zsh/vendor-completions/_lldpcli
13ff482
13ff482
# remove static libtool archive
13ff482
rm -f %{buildroot}%{_libdir}/liblldpctl.la
13ff482
13ff482
%pre
13ff482
getent group %{name} >/dev/null || groupadd -r %{name}
13ff482
getent passwd %{name} >/dev/null || \
13ff482
    useradd -r -g %{name} -d %{_sharedstatedir}/%{name} -s /sbin/nologin \
13ff482
    -c "Used by the %{name} daemon" %{name}
13ff482
exit 0
13ff482
13ff482
%post
13ff482
/sbin/ldconfig
a026e25
%if 0%{?with_systemd}
13ff482
%systemd_post %{name}.service
a026e25
%else
a026e25
# This adds the proper /etc/rc*.d links for the script
a026e25
/sbin/chkconfig --add %{name}
a026e25
%endif
13ff482
13ff482
%preun
a026e25
%if 0%{?with_systemd}
13ff482
%systemd_preun %{name}.service
a026e25
%else
a026e25
if [ $1 -eq 0 ] ; then
a026e25
    /sbin/service %{name} stop >/dev/null 2>&1
a026e25
    /sbin/chkconfig --del %{name}
a026e25
fi
a026e25
%endif
13ff482
13ff482
%postun
13ff482
/sbin/ldconfig
a026e25
%if 0%{?with_systemd}
13ff482
%systemd_postun_with_restart %{name}.service
a026e25
%else
a026e25
if [ "$1" -ge "1" ] ; then
a026e25
    /sbin/service %{name} condrestart >/dev/null 2>&1 || :
a026e25
fi
a026e25
%endif
13ff482
13ff482
%files
13ff482
%doc NEWS README.md
13ff482
%license LICENSE
13ff482
%{_sbindir}/lldpcli
13ff482
%{_sbindir}/lldpctl
13ff482
%{_sbindir}/%{name}
13ff482
%config %{_sysconfdir}/%{name}.d
13ff482
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
13ff482
%{_mandir}/man8/lldpcli.8*
13ff482
%{_mandir}/man8/lldpctl.8*
13ff482
%{_mandir}/man8/%{name}.8*
13ff482
%{_libdir}/liblldpctl.so.4
13ff482
%{_libdir}/liblldpctl.so.4.8.0
a026e25
%dir %{rundir}%{name}
a026e25
%dir %{rundir}%{name}/chroot
a026e25
%if 0%{?with_systemd}
13ff482
%{_unitdir}/%{name}.service
13ff482
%{_tmpfilesdir}/%{name}.conf
a026e25
%else
a026e25
%{_initddir}/%{name}
a026e25
%endif
13ff482
%dir %attr(-,lldpd,lldpd) %{_sharedstatedir}/%{name}
13ff482
13ff482
%files devel
13ff482
%{_includedir}/lldp-const.h
13ff482
%{_includedir}/lldpctl.h
13ff482
%{_libdir}/liblldpctl.so
13ff482
%{_libdir}/pkgconfig/lldpctl.pc
13ff482
13ff482
13ff482
%changelog
Igor Gnatenko b702b8b
* Thu Aug 10 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.9.7-8
Igor Gnatenko b702b8b
- Rebuilt for RPM soname bump
Igor Gnatenko b702b8b
9975eae
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.7-7
9975eae
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
9975eae
8b1f617
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.7-6
8b1f617
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
8b1f617
72e0ed2
* Thu Apr 06 2017 James Hogarth <james.hogarth@gmail.com> - 0.9.7-5
72e0ed2
- Older fedora needs the older syntax matching EPEL7
72e0ed2
1781f65
* Wed Apr 05 2017 James Hogarth <james.hogarth@gmail.com> - 0.9.7-4
1781f65
- EPEL7 systemd needs an older syntax
1781f65
7fc6e67
* Wed Apr 05 2017 James Hogarth <james.hogarth@gmail.com> - 0.9.7-3
7fc6e67
- Use the official release tarball rather than the github snapshot
a026e25
- Add EPEL6 conditionals
7fc6e67
13ff482
* Wed Apr 05 2017 James Hogarth <james.hogarth@gmail.com> - 0.9.7-2
13ff482
- Tweaks to spec requested in review
13ff482
13ff482
* Tue Apr 04 2017 James Hogarth <james.hogarth@gmail.com> - 0.9.7-1
13ff482
- Initial package