<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>52893</bug_id>
          
          <creation_ts>2025-02-01 03:25:09 +0300</creation_ts>
          <short_desc>Добавить макросы для поддержки systemd-sysusers</short_desc>
          <delta_ts>2025-02-07 08:53:26 +0300</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>rpm-build-systemd</component>
          <version>unstable</version>
          <rep_platform>x86_64</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugzilla.altlinux.org/show_bug.cgi?id=9895</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P5</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>52892</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Vitaly Lipatov">lav</reporter>
          <assigned_to name="Alexey Shabalin">shaba</assigned_to>
          <cc>antohami</cc>
    
    <cc>iv</cc>
    
    <cc>shaba</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>258419</commentid>
    <comment_count>0</comment_count>
    <who name="Vitaly Lipatov">lav</who>
    <bug_when>2025-02-01 03:25:09 +0300</bug_when>
    <thetext>Собственно пример использования описан в макросах, которые идут с 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 - &lt;&lt;SYSTEMD_INLINE_EOF || : \
%(cat %2) \
SYSTEMD_INLINE_EOF\
%{nil}

https://github.com/systemd/systemd/blob/main/src/rpm/macros.systemd.in#L180</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>258813</commentid>
    <comment_count>1</comment_count>
    <who name="Vitaly Lipatov">lav</who>
    <bug_when>2025-02-07 08:53:26 +0300</bug_when>
    <thetext>Макрос sysusers_create_package апстримный, имеется в rpm-macros-systemd и успешно используется:
https://packages.altlinux.org/ru/sisyphus/srpms/ollama/specfiles/</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>