From fc8a2c49d1d69182d0feaf6146393dc5b34d6eefe53d89540b25c221c85f5196 Mon Sep 17 00:00:00 2001 From: Stanislav Brabec Date: Thu, 18 Nov 2021 03:02:18 +0000 Subject: [PATCH] Accepting request 931593 from home:eeich:branches:hardware - Utilize sysuser infrastructure to set user/group powerman. OBS-URL: https://build.opensuse.org/request/show/931593 OBS-URL: https://build.opensuse.org/package/show/hardware/powerman?expand=0&rev=44 --- powerman.changes | 5 +++++ powerman.spec | 17 +++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/powerman.changes b/powerman.changes index 9fd3ca3..99a1409 100644 --- a/powerman.changes +++ b/powerman.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Nov 15 14:20:41 UTC 2021 - Egbert Eich + +- Utilize sysuser infrastructure to set user/group powerman. + ------------------------------------------------------------------- Tue Oct 19 13:06:07 UTC 2021 - Johannes Segitz diff --git a/powerman.spec b/powerman.spec index 514da95..f9b58b9 100644 --- a/powerman.spec +++ b/powerman.spec @@ -24,6 +24,7 @@ %if 0%{?suse_version} >= 1500 %define powerman_g %name %define powerman_u %name +%define have_sysuser 1 %else %define powerman_g daemon %define powerman_u root @@ -46,6 +47,7 @@ BuildRequires: ncurses-devel BuildRequires: pkg-config BuildRequires: tcpd-devel BuildRequires: pkgconfig(libcurl) +%{?have_sysuser:BuildRequires: sysuser-tools} %if 0%{?_with_snmppower} BuildRequires: net-snmp-devel %endif @@ -101,18 +103,20 @@ find %{buildroot} -type f -name "*.la" -delete -print ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name} %{__mkdir} -p %{buildroot}%{_tmpfilesdir} cat > %{buildroot}%{_tmpfilesdir}/%{name}.conf < system-user-%{name}.conf +%sysusers_generate_pre system-user-%{name}.conf powerman system-user-%{name}.conf +install -D -m 644 system-user-%{name}.conf %{buildroot}%{_sysusersdir}/system-user-%{name}.conf +%endif + %fdupes -s %{buildroot} -%pre +%pre %{?have_sysuser:-f %{name}.pre} %service_add_pre %{name}.service -%define powerman_descr "Power Manager service" -getent group %powerman_g >/dev/null || groupadd -r %powerman_g -getent passwd %powerman_u >/dev/null || useradd -r -g %powerman_g -M -s /bin/false -c %powerman_descr %powerman_u -exit 0 %post systemd-tmpfiles --create %{_tmpfilesdir}/powerman.conf @@ -138,6 +142,7 @@ systemd-tmpfiles --create %{_tmpfilesdir}/powerman.conf %config %{_sysconfdir}/powerman/ %attr(0644,root,root) %{_unitdir}/%{name}.service %{_tmpfilesdir}/powerman.conf +%{?have_sysuser:%{_sysusersdir}/system-user-%{name}.conf} %files devel %defattr(-,root,root)