diff --git a/mock-core-configs/mock-core-configs.spec b/mock-core-configs/mock-core-configs.spec index 420c5e8c9..ba594d303 100644 --- a/mock-core-configs/mock-core-configs.spec +++ b/mock-core-configs/mock-core-configs.spec @@ -50,7 +50,9 @@ Rocky Linux and various other specific or combined chroots. %install -mkdir -p %{buildroot}%{_sysusersdir} +%if 0%{?fedora} > 39 || 0%{?rhel} > 8 +cp -a mock.conf %{buildroot}%{_sysusersdir} +%endif mkdir -p %{buildroot}%{_sysconfdir}/mock/eol/templates mkdir -p %{buildroot}%{_sysconfdir}/mock/templates @@ -149,6 +151,9 @@ fi %license COPYING %doc README %ghost %config(noreplace,missingok) %{_sysconfdir}/mock/default.cfg +%if 0%{?fedora} > 39 || 0%{?rhel} > 8 +%config(noreplace) %{_sysusersdir}/mock.conf +%endif %changelog * Fri Apr 05 2024 Jakub Kadlcik 40.3-1 diff --git a/mock/mock.spec b/mock/mock.spec index fed1bae4a..447614d87 100644 --- a/mock/mock.spec +++ b/mock/mock.spec @@ -1,8 +1,7 @@ %bcond_with lint %bcond_without tests -# mock group id allocate for Fedora -%global mockgid 135 +%global mock_conf %{_builddir}/%{name}-%{version}/mock.conf %global __python %{__python3} %global python_sitelib %{python3_sitelib} @@ -67,6 +66,7 @@ BuildRequires: python%{python3_pkgversion}-pylint %endif BuildRequires: python%{python3_pkgversion}-rpm BuildRequires: python%{python3_pkgversion}-rpmautospec-core +BuildRequires: systemd-rpm-macros %if 0%{?fedora} >= 38 # DNF5 stack @@ -107,6 +107,7 @@ Requires: coreutils Requires: procps-ng Requires: shadow-utils +%{?sysusers_requires_compat} %description Mock takes an SRPM and builds it in a chroot. @@ -213,13 +214,14 @@ install -d %{buildroot}/var/cache/mock mkdir -p %{buildroot}%{_pkgdocdir} install -p -m 0644 docs/site-defaults.cfg %{buildroot}%{_pkgdocdir} +mkdir -p %{buildroot}%{_sysusersdir} +install -p -D -m 0644 %mock_conf %{buildroot}%{_sysusersdir}/mock.conf + sed -i 's/^_MOCK_NVR = None$/_MOCK_NVR = "%name-%version-%release"/' \ %{buildroot}%{_libexecdir}/mock/mock %pre filesystem -# check for existence of mock group, create it if not found -getent group mock > /dev/null || groupadd -f -g %mockgid -r mock -exit 0 +%sysusers_create_compat %mock_conf %check %if %{with lint}