0.187-5 - Add sysuser support for creating the debuginfod user

Resolves: #2096358
[RFE] elfutils use systemd-sysusers
This commit is contained in:
Mark Wielaard 2022-06-14 17:41:53 +02:00 committed by Mark Wielaard
parent 0ccdef5280
commit 8675595d8f
2 changed files with 26 additions and 1 deletions

View File

@ -0,0 +1 @@
u debuginfod - "elfutils debuginfo server" /var/cache/debuginfod -

View File

@ -1,11 +1,12 @@
Name: elfutils Name: elfutils
Version: 0.187 Version: 0.187
%global baserelease 4 %global baserelease 5
Release: %{baserelease}%{?dist} Release: %{baserelease}%{?dist}
URL: http://elfutils.org/ URL: http://elfutils.org/
%global source_url ftp://sourceware.org/pub/elfutils/%{version}/ %global source_url ftp://sourceware.org/pub/elfutils/%{version}/
License: GPLv3+ and (GPLv2+ or LGPLv3+) and GFDL License: GPLv3+ and (GPLv2+ or LGPLv3+) and GFDL
Source: %{?source_url}%{name}-%{version}.tar.bz2 Source: %{?source_url}%{name}-%{version}.tar.bz2
Source1: elfutils-debuginfod.sysusers
Summary: A collection of utilities and DSOs to handle ELF files and DWARF data Summary: A collection of utilities and DSOs to handle ELF files and DWARF data
# Needed for isa specific Provides and Requires. # Needed for isa specific Provides and Requires.
@ -61,6 +62,12 @@ BuildRequires: gettext-devel
%global provide_yama_scope 1 %global provide_yama_scope 1
%endif %endif
%global with_sysusers 0
%if 0%{?fedora} >= 32 || 0%{?rhel} >= 9
%global with_sysusers 1
%endif
# Patches # Patches
# For s390x... FDO package notes are bogus. # For s390x... FDO package notes are bogus.
@ -216,6 +223,9 @@ Requires: elfutils-libs%{depsuffix} = %{version}-%{release}
Requires: elfutils-libelf%{depsuffix} = %{version}-%{release} Requires: elfutils-libelf%{depsuffix} = %{version}-%{release}
Requires: elfutils-debuginfod-client%{depsuffix} = %{version}-%{release} Requires: elfutils-debuginfod-client%{depsuffix} = %{version}-%{release}
BuildRequires: systemd BuildRequires: systemd
%if %{with_sysusers}
BuildRequires: systemd-rpm-macros
%endif
BuildRequires: make BuildRequires: make
Requires(post): systemd Requires(post): systemd
Requires(preun): systemd Requires(preun): systemd
@ -283,6 +293,10 @@ install -Dm0644 config/debuginfod.sysconfig ${RPM_BUILD_ROOT}%{_sysconfdir}/sysc
mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/cache/debuginfod mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/cache/debuginfod
touch ${RPM_BUILD_ROOT}%{_localstatedir}/cache/debuginfod/debuginfod.sqlite touch ${RPM_BUILD_ROOT}%{_localstatedir}/cache/debuginfod/debuginfod.sqlite
%if %{with_sysusers}
install -Dm0644 %{SOURCE1} %{buildroot}%{_sysusersdir}/elfutils-debuginfod.conf
%endif
%check %check
# Record some build root versions in build.log # Record some build root versions in build.log
uname -r; rpm -q binutils gcc glibc || true uname -r; rpm -q binutils gcc glibc || true
@ -394,17 +408,24 @@ fi
%config(noreplace) %{_sysconfdir}/sysconfig/debuginfod %config(noreplace) %{_sysconfdir}/sysconfig/debuginfod
%{_unitdir}/debuginfod.service %{_unitdir}/debuginfod.service
%{_sysconfdir}/sysconfig/debuginfod %{_sysconfdir}/sysconfig/debuginfod
%if %{with_sysusers}
%{_sysusersdir}/elfutils-debuginfod.conf
%endif
%{_mandir}/man8/debuginfod.8* %{_mandir}/man8/debuginfod.8*
%dir %attr(0700,debuginfod,debuginfod) %{_localstatedir}/cache/debuginfod %dir %attr(0700,debuginfod,debuginfod) %{_localstatedir}/cache/debuginfod
%ghost %attr(0600,debuginfod,debuginfod) %{_localstatedir}/cache/debuginfod/debuginfod.sqlite %ghost %attr(0600,debuginfod,debuginfod) %{_localstatedir}/cache/debuginfod/debuginfod.sqlite
%pre debuginfod %pre debuginfod
%if %{with_sysusers}
%sysusers_create_compat %{SOURCE1}
%else
getent group debuginfod >/dev/null || groupadd -r debuginfod getent group debuginfod >/dev/null || groupadd -r debuginfod
getent passwd debuginfod >/dev/null || \ getent passwd debuginfod >/dev/null || \
useradd -r -g debuginfod -d /var/cache/debuginfod -s /sbin/nologin \ useradd -r -g debuginfod -d /var/cache/debuginfod -s /sbin/nologin \
-c "elfutils debuginfo server" debuginfod -c "elfutils debuginfo server" debuginfod
exit 0 exit 0
%endif
%post debuginfod %post debuginfod
%systemd_post debuginfod.service %systemd_post debuginfod.service
@ -413,6 +434,9 @@ exit 0
%systemd_postun_with_restart debuginfod.service %systemd_postun_with_restart debuginfod.service
%changelog %changelog
* Tue Jun 14 2022 Mark Wielaard <mjw@fedoraproject.org> - 0.187-5
- Add sysuser support for creating the debuginfod user
* Fri May 6 2022 Mark Wielaard <mjw@fedoraproject.org> - 0.187-4 * Fri May 6 2022 Mark Wielaard <mjw@fedoraproject.org> - 0.187-4
- Add elfutils-0.187-mhd_no_dual_stack.patch - Add elfutils-0.187-mhd_no_dual_stack.patch
- Add elfutils-0.187-mhd_epoll.patch - Add elfutils-0.187-mhd_epoll.patch