Use systemd-sysusers for the 'pegasus' user and group creation

This commit is contained in:
Vitezslav Crhonek 2022-08-02 14:55:39 +02:00
parent 3cb7a35656
commit e1f7039497
2 changed files with 18 additions and 7 deletions

View File

@ -3,12 +3,10 @@
%global srcname pegasus %global srcname pegasus
%global major_ver 2.14 %global major_ver 2.14
%global pegasus_gid 65
%global pegasus_uid 66
Name: tog-pegasus Name: tog-pegasus
Version: %{major_ver}.1 Version: %{major_ver}.1
Release: 66%{?dist} Release: 67%{?dist}
Epoch: 2 Epoch: 2
Summary: OpenPegasus WBEM Services for Linux Summary: OpenPegasus WBEM Services for Linux
@ -38,6 +36,8 @@ Source10: generate-certs
Source11: snmptrapd.conf Source11: snmptrapd.conf
# 12: repupgrade man page based on pegasus/src/Clients/repupgrade/doc/repupgrade.html # 12: repupgrade man page based on pegasus/src/Clients/repupgrade/doc/repupgrade.html
Source12: repupgrade.1.gz Source12: repupgrade.1.gz
# 13: sysusers conf file for dynamic creation of the 'pegasus' user and group
Source13: tog-pegasus.sysusers
# 1: http://cvs.rdg.opengroup.org/bugzilla/show_bug.cgi?id=5011 # 1: http://cvs.rdg.opengroup.org/bugzilla/show_bug.cgi?id=5011
# Removing insecure -rpath # Removing insecure -rpath
@ -115,7 +115,7 @@ BuildRequires: bash, sed, grep, coreutils, procps, gcc, gcc-c++
BuildRequires: libstdc++, make, pam-devel BuildRequires: libstdc++, make, pam-devel
BuildRequires: openssl-devel BuildRequires: openssl-devel
BuildRequires: net-snmp-devel, openslp-devel BuildRequires: net-snmp-devel, openslp-devel
BuildRequires: systemd-units BuildRequires: systemd-units systemd-rpm-macros
Requires: net-snmp-libs Requires: net-snmp-libs
Requires: %{name}-libs = %{epoch}:%{version}-%{release} Requires: %{name}-libs = %{epoch}:%{version}-%{release}
Requires: openssl Requires: openssl
@ -369,6 +369,9 @@ install -p Schemas/CIM238/DMTF/Core/CIM_AbstractComponent.mof $RPM_BUILD_ROOT/us
mkdir -p ${RPM_BUILD_ROOT}/%{_mandir}/man1/ mkdir -p ${RPM_BUILD_ROOT}/%{_mandir}/man1/
cp %SOURCE12 ${RPM_BUILD_ROOT}/%{_mandir}/man1/ cp %SOURCE12 ${RPM_BUILD_ROOT}/%{_mandir}/man1/
# install sysusers conf file
install -p -D -m 0644 %{SOURCE13} %{buildroot}%{_sysusersdir}/tog-pegasus.conf
%check %check
# run unit tests # run unit tests
export LD_LIBRARY_PATH=$RPM_BUILD_ROOT/usr/%{_lib} export LD_LIBRARY_PATH=$RPM_BUILD_ROOT/usr/%{_lib}
@ -441,6 +444,7 @@ rm $RPM_BUILD_ROOT/usr/share/Pegasus/test/testtracer4.trace.0
/usr/share/Pegasus/html /usr/share/Pegasus/html
%files libs %files libs
%{_sysusersdir}/tog-pegasus.conf
%defattr(0755, root, pegasus, 0755) %defattr(0755, root, pegasus, 0755)
%{_libdir}/* %{_libdir}/*
%exclude /usr/lib/debug %exclude /usr/lib/debug
@ -516,9 +520,9 @@ fi
%pre libs %pre libs
if [ $1 -eq 1 ]; then if [ $1 -eq 1 ]; then
# first install: create the 'pegasus' user and group: # first install: create the 'pegasus' user and group:
/usr/sbin/groupadd -g %{pegasus_gid} -f -r pegasus >/dev/null 2>&1 || :; {
/usr/sbin/useradd -u %{pegasus_uid} -r -N -M -g pegasus -s /sbin/nologin -d /var/lib/Pegasus \ %sysusers_create_compat %{SOURCE13}
-c "tog-pegasus OpenPegasus WBEM/CIM services" pegasus >/dev/null 2>&1 || :; } >/dev/null 2>&1 || :;
fi fi
:; :;
@ -564,6 +568,10 @@ fi
%changelog %changelog
* Tue Aug 02 2022 Vitezslav Crhonek <vcrhonek@redhat.com> - 2.14.1-67
- Use systemd-sysusers for the 'pegasus' user and group creation
Resolves: #2095477
* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2:2.14.1-66 * Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2:2.14.1-66
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

3
tog-pegasus.sysusers Normal file
View File

@ -0,0 +1,3 @@
#Type Name ID GECOS Home directory Shell
g pegasus 65
u pegasus 66 "tog-pegasus OpenPegasus WBEM/CIM services" /var/lib/Pegasus /sbin/nologin