Bug 52893 - Добавить макросы для поддержки systemd-sysusers
Summary: Добавить макросы для поддержки systemd-sysusers
Status: NEW
Alias: None
Product: Sisyphus
Classification: Development
Component: rpm-build-systemd (show other bugs)
Version: unstable
Hardware: x86_64 Linux
: P5 normal
Assignee: Alexey Shabalin
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on: 52892
Blocks:
  Show dependency tree
 
Reported: 2025-02-01 03:25 MSK by Vitaly Lipatov
Modified: 2025-02-01 03:25 MSK (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vitaly Lipatov 2025-02-01 03:25:09 MSK
Собственно пример использования описан в макросах, которые идут с systemd.

Предполагается, что файл для sysusers упаковывается, но если пользователи должны быть созданы до установки пакета, то в %pre вызывается создание пользователя с указанием фиктивного файла (что имеет поддержку в systemd).

# This should be used by package installation scripts which require users or
# groups to be present before the files installed by the package are present on
# disk (for example because some files are owned by those users or groups).
#
# Example:
#   Source1: %{name}-sysusers.conf
#   ...
#   %install
#   install -D %SOURCE1 %{buildroot}%{_sysusersdir}/%{name}.conf
#   %pre
#   %sysusers_create_package %{name} %SOURCE1
#   %files
#   %{_sysusersdir}/%{name}.conf
%sysusers_create_package() \
%{expand:%%{?!__systemd_twoargs_%#:%%{error:The %%%%sysusers_create_package macro requires two arguments}}} \
systemd-sysusers --replace=%_sysusersdir/%1.conf - <<SYSTEMD_INLINE_EOF || : \
%(cat %2) \
SYSTEMD_INLINE_EOF\
%{nil}

https://github.com/systemd/systemd/blob/main/src/rpm/macros.systemd.in#L180