diff --git a/mock-core-configs/mock-core-configs.spec b/mock-core-configs/mock-core-configs.spec index 420c5e8c9..869562f8f 100644 --- a/mock-core-configs/mock-core-configs.spec +++ b/mock-core-configs/mock-core-configs.spec @@ -50,8 +50,6 @@ Rocky Linux and various other specific or combined chroots. %install -mkdir -p %{buildroot}%{_sysusersdir} - mkdir -p %{buildroot}%{_sysconfdir}/mock/eol/templates mkdir -p %{buildroot}%{_sysconfdir}/mock/templates cp -a etc/mock/*.cfg %{buildroot}%{_sysconfdir}/mock diff --git a/mock-core-configs/mock.conf b/mock-core-configs/mock.conf deleted file mode 100644 index 73912e38a..000000000 --- a/mock-core-configs/mock.conf +++ /dev/null @@ -1,2 +0,0 @@ -#Type Name ID GECOS Home directory Shell -g mock 135 - diff --git a/mock/mock.spec b/mock/mock.spec index fed1bae4a..9d81babb6 100644 --- a/mock/mock.spec +++ b/mock/mock.spec @@ -1,9 +1,6 @@ %bcond_with lint %bcond_without tests -# mock group id allocate for Fedora -%global mockgid 135 - %global __python %{__python3} %global python_sitelib %{python3_sitelib} @@ -146,6 +143,9 @@ Mock plugin that preprocesses spec files using rpmautospec. %package filesystem Summary: Mock filesystem layout Requires(pre): shadow-utils +BuildRequires: systemd-rpm-macros + +%{?sysusers_requires_compat} %description filesystem Filesystem layout and group for Mock. @@ -156,6 +156,7 @@ for file in py/mock.py py/mock-parse-buildlog.py; do sed -i 1"s|#!/usr/bin/python3 |#!%{__python} |" $file done + %build for i in py/mockbuild/constants.py py/mock-parse-buildlog.py; do perl -p -i -e 's|^VERSION\s*=.*|VERSION="%{version}"|' $i @@ -169,6 +170,8 @@ done ./precompile-bash-completion "mock.complete" +%sysusers_create_compat mock.conf >> sysusers_script + %install #base filesystem mkdir -p %{buildroot}%{_sysconfdir}/mock/eol/templates @@ -213,13 +216,15 @@ 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 %{name}.conf %{buildroot}%{_sysusersdir} + 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 + +%pre filesystem -f sysusers_script + %check %if %{with lint} @@ -257,6 +262,7 @@ pylint-3 py/mockbuild/ py/*.py py/mockbuild/plugins/* || : %config(noreplace) %{_sysconfdir}/%{name}/*.ini %config(noreplace) %{_sysconfdir}/pam.d/%{name} %config(noreplace) %{_sysconfdir}/security/console.apps/%{name} +%{_sysusersdir}/mock.conf # directory for personal gpg keys %dir %{_sysconfdir}/pki/mock diff --git a/releng/release-notes-next/sysusers-handled-by-rpm.feature b/releng/release-notes-next/sysusers-handled-by-rpm.feature new file mode 100644 index 000000000..0bd336885 --- /dev/null +++ b/releng/release-notes-next/sysusers-handled-by-rpm.feature @@ -0,0 +1,6 @@ +This provides users/groups via /usr/lib/sysusers.d. This is going +to be handled by RPM as described in +https://docs.fedoraproject.org/en-US/packaging-guidelines/UsersAndGroups/#_dynamic_allocation + +Fixes fedora-copr/copr#2789 +