#26 samba-common: move group creation logic to sysusers.d fragment
Closed 2 years ago by asn. Opened 2 years ago by lucab.
rpms/ lucab/samba ups/sysusers  into  rawhide

@@ -0,0 +1,2 @@ 

+ #Type Name       ID

+ g     printadmin -

file modified
+9 -2
@@ -135,7 +135,7 @@ 

  %define samba_requires_eq()  %(LC_ALL="C" echo '%*' | xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}\\n' | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not")

  

  %global samba_version 4.17.0

- %global baserelease 9

+ %global baserelease 10

  # This should be rc1 or %%nil

  %global pre_release rc4

  
@@ -225,6 +225,7 @@ 

  Source13:       pam_winbind.conf

  Source14:       samba.pamd

  Source15:       samba.abignore

+ Source16:       samba-common-systemd-sysusers.conf

  

  Source201:      README.downgrade

  
@@ -309,6 +310,7 @@ 

  BuildRequires: rpcgen

  BuildRequires: rpcsvc-proto-devel

  BuildRequires: sed

+ BuildRequires: systemd-rpm-macros

  BuildRequires: libtasn1-devel

  # We need asn1Parser

  BuildRequires: libtasn1-tools
@@ -1303,6 +1305,7 @@ 

  

  install -m 0744 packaging/printing/smbprint %{buildroot}%{_bindir}/smbprint

  

+ install -p -D -m 0644 %{SOURCE16} %{buildroot}%{_sysusersdir}/samba-common.conf

  install -d -m 0755 %{buildroot}%{_tmpfilesdir}

  # Create /run/samba.

  echo "d /run/samba  755 root root" > %{buildroot}%{_tmpfilesdir}/samba.conf
@@ -1472,7 +1475,7 @@ 

  %systemd_postun_with_restart nmb.service

  

  %pre common

- getent group printadmin >/dev/null || groupadd -r printadmin || :

+ %sysusers_create_compat %{SOURCE16}

  

  %post common

  %{?ldconfig}
@@ -1973,6 +1976,7 @@ 

  ### COMMON

  %files common

  %{_tmpfilesdir}/samba.conf

+ %{_sysusersdir}/samba-common.conf

  %dir %{_sysconfdir}/logrotate.d/

  %config(noreplace) %{_sysconfdir}/logrotate.d/samba

  %attr(0700,root,root) %dir /var/log/samba
@@ -4239,6 +4243,9 @@ 

  %endif

  

  %changelog

+ * Mon Sep 05 2022 Luca BRUNO <lucab@lucabruno.net> - 4.17.0-0.10.rc4

+ - Move group creation logic to sysusers.d fragment

+ 

  * Wed Aug 31 2022 Guenther Deschner <gdeschner@redhat.com> - 4.17.0-0.9.rc4

  - resolves: #2118818 - Update to version 4.17.0rc4

  

Thank you very much for your contribution!

ill this work on RHEL8? The spec file need to work there too ...

RHEL9 should already have the relevant systemd macros.
But RHEL8 I don't think so.

Could you please change the PR that it still works with RHEL8? I'm fine with using it on RHEL9 and Fedora.

I don't have a quick way to adapt and test this on RHEL8. Feel free to pick up and conditionalize the relevant bits from here.

Pull-Request has been closed by asn

2 years ago

Thanks for pushing this through the finish line!