Blame SPECS/lldpd.spec

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