Skip to content

Commit

Permalink
Using systemd for pkiuser in fedora
Browse files Browse the repository at this point in the history
  • Loading branch information
fmarco76 committed Feb 13, 2025
1 parent 25b01d4 commit 83d6a75
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
5 changes: 5 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ jobs:
-e '/^\/usr\/share\/pki\/lib\/resteasy-jackson2-provider-.*\.jar/d' \
-e '/^\/usr\/share\/pki\/server\/common\/lib\/resteasy-servlet-initializer-.*\.jar/d' \
file_list
# exclude user managemant files only available in RPM
sed -i \
-e '/^\/usr\/lib\/sysusers\.d\/dogtag-pki\.conf/d' \
file_list
displayName: Get list of files from RPM packages
- script: |
Expand Down
23 changes: 22 additions & 1 deletion pki.spec
Original file line number Diff line number Diff line change
Expand Up @@ -1198,6 +1198,16 @@ fi
%mvn_package org.dogtagpki.pki:pki-console pki-console
%endif

%if 0%{?fedora}
# Create a sysusers.d config file

cat > %{product_id}.sysusers.conf <<EOF
g %{pki_username} %{pki_gid}
u %{pki_groupname} %{pki_uid} 'Certificate System' %{pki_homedir} -
EOF

%endif

################################################################################
%build
################################################################################
Expand Down Expand Up @@ -1504,6 +1514,13 @@ xmlstarlet edit --inplace \

%if %{with server}

%if 0%{?fedora}

install -m0644 -D %{product_id}.sysusers.conf %{buildroot}%{_sysusersdir}/%{product_id}.conf
%pre -n %{product_id}-server

%else

%pre -n %{product_id}-server

# create PKI group if it doesn't exist
Expand All @@ -1514,6 +1531,8 @@ if ! getent passwd %{pki_username} >/dev/null ; then
useradd -r -u %{pki_uid} -g %{pki_groupname} -d %{pki_homedir} -s /sbin/nologin -c "Certificate System" %{pki_username}
fi

%endif

# create PKI home directory if it doesn't exist
if [ ! -d %{pki_homedir} ] ; then
cp -ar /etc/skel %{pki_homedir}
Expand Down Expand Up @@ -1783,7 +1802,9 @@ fi
%{_mandir}/man8/pki-healthcheck.8.gz
%{_datadir}/pki/setup/
%{_datadir}/pki/server/

%if 0%{?fedora}
%{_sysusersdir}/%{product_id}.conf
%endif
%if %{without maven}
%{_datadir}/java/pki/pki-server.jar
%{_datadir}/java/pki/pki-server-webapp.jar
Expand Down

0 comments on commit 83d6a75

Please sign in to comment.