Skip to content

Commit 4e6838c

Browse files
Merge pull request #1512 from bluca/sysusers
Install sysusers.d config for user/groups
2 parents 8779733 + 9bb4266 commit 4e6838c

10 files changed

Lines changed: 1786 additions & 1158 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
/cgi-bin/testhi.index
3232
/cgi-bin/testtemplate
3333
/conf/cups-files.conf
34+
/conf/cups-sysusers.conf
35+
/conf/cups-sysusers-groups.conf
3436
/conf/cupsd.conf
3537
/conf/mime.convs
3638
/conf/pam.std

Makedefs.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,9 @@ INITDDIR = @INITDDIR@
243243
LAUNCHD_DIR = @LAUNCHD_DIR@
244244
SMFMANIFESTDIR = @SMFMANIFESTDIR@
245245
SYSTEMD_DIR = @SYSTEMD_DIR@
246+
SYSUSERS_DIR = @SYSUSERS_DIR@
247+
INSTALL_SYSUSERS = @INSTALL_SYSUSERS@
248+
INSTALL_SYSUSERS_GROUPS = @INSTALL_SYSUSERS_GROUPS@
246249
XINETD = @XINETD@
247250

248251
USBQUIRKS = @USBQUIRKS@

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ clean:
100100

101101
distclean: clean
102102
$(RM) Makedefs config.h config.log config.status
103-
$(RM) conf/cups-files.conf conf/cupsd.conf conf/mime.convs conf/pam.std conf/snmp.conf
103+
$(RM) conf/cups-files.conf conf/cups-sysusers.conf conf/cupsd.conf conf/mime.convs conf/pam.std conf/snmp.conf
104104
$(RM) cups.pc
105105
$(RM) desktop/cups.desktop
106106
$(RM) doc/index.html

conf/Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ install-data:
9191
$(INSTALL_DATA) $(PAMFILE) $(BUILDROOT)$(PAMDIR)/cups ; \
9292
fi ; \
9393
fi
94+
-if test x$(SYSUSERS_DIR) != x -a x$(INSTALL_SYSUSERS) != x; then \
95+
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(SYSUSERS_DIR); \
96+
$(INSTALL_DATA) cups-sysusers.conf $(BUILDROOT)$(SYSUSERS_DIR)/cups.conf; \
97+
fi
98+
-if test x$(SYSUSERS_DIR) != x -a x$(INSTALL_SYSUSERS_GROUPS) != x; then \
99+
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(SYSUSERS_DIR); \
100+
$(INSTALL_DATA) cups-sysusers-groups.conf $(BUILDROOT)$(SYSUSERS_DIR)/cups-groups.conf; \
101+
fi
94102

95103

96104
#
@@ -131,3 +139,8 @@ uninstall:
131139
$(RM) $(BUILDROOT)$(PAMDIR)/cups; \
132140
$(RMDIR) $(BUILDROOT)$(PAMDIR); \
133141
fi
142+
-if test x$(SYSUSERS_DIR) != x; then \
143+
$(RM) $(BUILDROOT)$(SYSUSERS_DIR)/cups.conf; \
144+
$(RM) $(BUILDROOT)$(SYSUSERS_DIR)/cups-groups.conf; \
145+
$(RMDIR) $(BUILDROOT)$(SYSUSERS_DIR); \
146+
fi

conf/cups-sysusers-groups.conf.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# sysusers.d(5) config file for the CUPS administrative group(s).
2+
3+
@CUPS_SYSUSERS_SYSTEM_GROUPS@

conf/cups-sysusers.conf.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# sysusers.d(5) config file for the CUPS user and group.
2+
3+
@CUPS_SYSUSERS_GROUP@
4+
@CUPS_SYSUSERS_USER@

config-scripts/cups-defaults.m4

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,49 @@ AC_DEFINE_UNQUOTED([CUPS_DEFAULT_USER], ["$CUPS_USER"], [Default User value.])
298298
AC_DEFINE_UNQUOTED([CUPS_DEFAULT_GROUP], ["$CUPS_GROUP"], [Default Group value.])
299299
AC_DEFINE_UNQUOTED([CUPS_DEFAULT_SYSTEM_GROUPS], ["$CUPS_SYSTEM_GROUPS"], [Default SystemGroup value(s).])
300300

301+
dnl sysusers.d entries for CUPS user and group...
302+
CUPS_SYSUSERS_GROUP=""
303+
CUPS_SYSUSERS_USER=""
304+
AS_IF([test "x$CUPS_USER" != "xroot" -a "x$CUPS_USER" != "xnobody"], [
305+
AS_IF([test "x$CUPS_GROUP" != "xroot" -a "x$CUPS_GROUP" != "xnobody" -a "x$CUPS_GROUP" != "xnogroup"], [
306+
CUPS_SYSUSERS_USER="u $CUPS_USER -:$CUPS_GROUP \"CUPS printing service\""
307+
], [
308+
CUPS_SYSUSERS_USER="u $CUPS_USER - \"CUPS printing service\""
309+
])
310+
], [
311+
AS_IF([test "x$CUPS_GROUP" != "xroot" -a "x$CUPS_GROUP" != "xnobody" -a "x$CUPS_GROUP" != "xnogroup"], [
312+
CUPS_SYSUSERS_GROUP="g $CUPS_GROUP"
313+
])
314+
])
315+
AC_SUBST([CUPS_SYSUSERS_GROUP])
316+
AC_SUBST([CUPS_SYSUSERS_USER])
317+
318+
AS_IF([test "x$CUPS_SYSUSERS_USER" != x -o "x$CUPS_SYSUSERS_GROUP" != x], [
319+
INSTALL_SYSUSERS="install-sysusers"
320+
], [
321+
INSTALL_SYSUSERS=""
322+
])
323+
AC_SUBST([INSTALL_SYSUSERS])
324+
325+
CUPS_SYSUSERS_SYSTEM_GROUPS=""
326+
for group in $CUPS_SYSTEM_GROUPS; do
327+
AS_IF([test "x$group" != "xroot" -a "x$group" != "xnobody" -a "x$group" != "xnogroup"], [
328+
AS_IF([test "x$CUPS_SYSUSERS_SYSTEM_GROUPS" = x], [
329+
CUPS_SYSUSERS_SYSTEM_GROUPS="g $group"
330+
], [
331+
CUPS_SYSUSERS_SYSTEM_GROUPS="$CUPS_SYSUSERS_SYSTEM_GROUPS
332+
g $group"
333+
])
334+
])
335+
done
336+
AC_SUBST([CUPS_SYSUSERS_SYSTEM_GROUPS])
337+
338+
AS_IF([test "x$CUPS_SYSUSERS_SYSTEM_GROUPS" != x], [
339+
INSTALL_SYSUSERS_GROUPS="install-sysusers-groups"
340+
], [
341+
INSTALL_SYSUSERS_GROUPS=""
342+
])
343+
AC_SUBST([INSTALL_SYSUSERS_GROUPS])
301344

302345
dnl Default printcap file...
303346
AC_ARG_WITH([printcap], AS_HELP_STRING([--with-printcap], [set default printcap file]), [

config-scripts/cups-directories.m4

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,3 +284,20 @@ AC_ARG_WITH([rundir], AS_HELP_STRING([--with-rundir], [set transient run-time st
284284
])
285285
AC_DEFINE_UNQUOTED([CUPS_STATEDIR], ["$CUPS_STATEDIR"], [Location of transient state files.])
286286
AC_SUBST([CUPS_STATEDIR])
287+
288+
dnl sysusers.d directory...
289+
AC_ARG_WITH([sysusersdir], AS_HELP_STRING([--with-sysusersdir], [set directory for sysusers.d config file]), [
290+
SYSUSERS_DIR="$withval"
291+
], [
292+
SYSUSERS_DIR=""
293+
AS_IF([test "x$PKGCONFIG" != x], [
294+
AS_IF([$PKGCONFIG --exists systemd], [
295+
SYSUSERS_DIR="$($PKGCONFIG --variable=sysusersdir systemd)"
296+
])
297+
])
298+
])
299+
300+
AS_IF([test "x$SYSUSERS_DIR" = xno], [
301+
SYSUSERS_DIR=""
302+
])
303+
AC_SUBST([SYSUSERS_DIR])

0 commit comments

Comments
 (0)