Blame SPECS/lldpd.spec

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