Skip to content

Commit

Permalink
Linux: Don't create user for systemd units use sysusers
Browse files Browse the repository at this point in the history
Signed-off-by: Björn Bidar <[email protected]>
  • Loading branch information
Thaodan committed Oct 28, 2022
1 parent 0a29296 commit c508af8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion davmail.spec
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ install -D -m 644 src/init/davmail.service %{buildroot}%{_unitdir}/davmail.servi
install -D -m 644 src/init/[email protected] %{buildroot}%{_unitdir}/[email protected]
install -D -m 644 src/init/davmail-user.service %{buildroot}%{_userunitdir}/davmail.service
install -D -m 644 src/init/daivmail.conf %{buildroot}%{_tmpfilesdir}/davmail.conf
install -D -m 644 src/init/daivmail_sysusers.conf %{buildroot}%{_sysusersdir}/davmail.conf
%else
install -m 0775 src/init/davmail-init $RPM_BUILD_ROOT%{_sysconfdir}/init.d/davmail
ln -sf %{_sysconfdir}/init.d/davmail $RPM_BUILD_ROOT%{_sbindir}/rcdavmail
Expand All @@ -132,10 +133,11 @@ install -m 0644 src/appstream/org.davmail.DavMail.appdata.xml $RPM_BUILD_ROOT%{_
rm -rf $RPM_BUILD_ROOT

%pre
%if 0%{!?systemd_macros:1}
/usr/sbin/groupadd -f -r davmail > /dev/null 2>&1 || :
/usr/sbin/useradd -r -s /sbin/nologin -d /var/lib/davmail -M \
-g davmail davmail > /dev/null 2>&1 || :
%if %systemd_macros
%else
%service_add_pre davmail.service
%endif

Expand Down Expand Up @@ -230,6 +232,7 @@ fi
- Create initial log file with systemd-tmpfiles
- Harden systemd service
- Add systemd system sevice template unit
- Don't create user for systemd units use sysusers
* Wed Jul 07 2021 Michal Suchanek <[email protected]>
- Tumbleweed no longer supports init.d services and fails build when installed
Expand Down
2 changes: 2 additions & 0 deletions src/init/davmail_sysusers.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#Type Name ID GECOS Home directory Shell
u davmail - "DavMail Exchange and Office 365 Gateway" - -

0 comments on commit c508af8

Please sign in to comment.