Skip to content

Commit c508af8

Browse files
committed
Linux: Don't create user for systemd units use sysusers
Signed-off-by: Björn Bidar <[email protected]>
1 parent 0a29296 commit c508af8

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

davmail.spec

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ install -D -m 644 src/init/davmail.service %{buildroot}%{_unitdir}/davmail.servi
109109
install -D -m 644 src/init/[email protected] %{buildroot}%{_unitdir}/[email protected]
110110
install -D -m 644 src/init/davmail-user.service %{buildroot}%{_userunitdir}/davmail.service
111111
install -D -m 644 src/init/daivmail.conf %{buildroot}%{_tmpfilesdir}/davmail.conf
112+
install -D -m 644 src/init/daivmail_sysusers.conf %{buildroot}%{_sysusersdir}/davmail.conf
112113
%else
113114
install -m 0775 src/init/davmail-init $RPM_BUILD_ROOT%{_sysconfdir}/init.d/davmail
114115
ln -sf %{_sysconfdir}/init.d/davmail $RPM_BUILD_ROOT%{_sbindir}/rcdavmail
@@ -132,10 +133,11 @@ install -m 0644 src/appstream/org.davmail.DavMail.appdata.xml $RPM_BUILD_ROOT%{_
132133
rm -rf $RPM_BUILD_ROOT
133134

134135
%pre
136+
%if 0%{!?systemd_macros:1}
135137
/usr/sbin/groupadd -f -r davmail > /dev/null 2>&1 || :
136138
/usr/sbin/useradd -r -s /sbin/nologin -d /var/lib/davmail -M \
137139
-g davmail davmail > /dev/null 2>&1 || :
138-
%if %systemd_macros
140+
%else
139141
%service_add_pre davmail.service
140142
%endif
141143

@@ -230,6 +232,7 @@ fi
230232
- Create initial log file with systemd-tmpfiles
231233
- Harden systemd service
232234
- Add systemd system sevice template unit
235+
- Don't create user for systemd units use sysusers
233236
234237
* Wed Jul 07 2021 Michal Suchanek <[email protected]>
235238
- Tumbleweed no longer supports init.d services and fails build when installed

src/init/davmail_sysusers.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#Type Name ID GECOS Home directory Shell
2+
u davmail - "DavMail Exchange and Office 365 Gateway" - -

0 commit comments

Comments
 (0)