systemd/cups: backport patch to install sysusers config

Upstream cups has support for generating/installing sysuser config but
it's not yet in a release version. Backport the patch to when it gets
into a release, we'll know to drop the patch.

Fixes #4649

Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8875>
This commit is contained in:
Clayton Craft
2026-07-24 20:16:23 +00:00
parent 6d6d684bfe
commit 1c7ff6bc68
3 changed files with 6843 additions and 2 deletions
@@ -0,0 +1,188 @@
From 2752c054e6fa37779a9706d43aa0e883264ad30d Mon Sep 17 00:00:00 2001
From: Aster Boese <asterboese@mailbox.org>
Date: Fri, 24 Jul 2026 19:59:42 +0200
Subject: [PATCH] Install sysusers.d config for user/groups
Backport of 5be4a9b316a511128d7bae2e0172e7f8eca04074
---
Makedefs.in | 3 +++
Makefile | 2 +-
conf/Makefile | 13 +++++++++
conf/cups-sysusers-groups.conf.in | 3 +++
conf/cups-sysusers.conf.in | 4 +++
config-scripts/cups-defaults.m4 | 43 ++++++++++++++++++++++++++++++
config-scripts/cups-directories.m4 | 17 ++++++++++++
configure.ac | 2 ++
9 files changed, 88 insertions(+), 1 deletion(-)
create mode 100644 conf/cups-sysusers-groups.conf.in
create mode 100644 conf/cups-sysusers.conf.in
diff --git a/Makedefs.in b/Makedefs.in
index 6158e61d9..4eb04ada9 100644
--- a/Makedefs.in
+++ b/Makedefs.in
@@ -250,6 +250,9 @@ INITDDIR = @INITDDIR@
LAUNCHD_DIR = @LAUNCHD_DIR@
SMFMANIFESTDIR = @SMFMANIFESTDIR@
SYSTEMD_DIR = @SYSTEMD_DIR@
+SYSUSERS_DIR = @SYSUSERS_DIR@
+INSTALL_SYSUSERS = @INSTALL_SYSUSERS@
+INSTALL_SYSUSERS_GROUPS = @INSTALL_SYSUSERS_GROUPS@
XINETD = @XINETD@
USBQUIRKS = @USBQUIRKS@
diff --git a/Makefile b/Makefile
index 01321d526..a8efdc072 100644
--- a/Makefile
+++ b/Makefile
@@ -101,7 +101,7 @@ clean:
distclean: clean
$(RM) Makedefs config.h config.log config.status
- $(RM) conf/cups-files.conf conf/cupsd.conf conf/mime.convs conf/pam.std conf/snmp.conf
+ $(RM) conf/cups-files.conf conf/cups-sysusers.conf conf/cupsd.conf conf/mime.convs conf/pam.std conf/snmp.conf
$(RM) cups-config
$(RM) cups.pc
$(RM) desktop/cups.desktop
diff --git a/conf/Makefile b/conf/Makefile
index 62aa0c6fd..c773139f9 100644
--- a/conf/Makefile
+++ b/conf/Makefile
@@ -92,6 +92,14 @@ install-data:
fi ; \
fi
+ -if test x$(SYSUSERS_DIR) != x -a x$(INSTALL_SYSUSERS) != x; then \
+ $(INSTALL_DIR) -m 755 $(BUILDROOT)$(SYSUSERS_DIR); \
+ $(INSTALL_DATA) cups-sysusers.conf $(BUILDROOT)$(SYSUSERS_DIR)/cups.conf; \
+ fi
+ -if test x$(SYSUSERS_DIR) != x -a x$(INSTALL_SYSUSERS_GROUPS) != x; then \
+ $(INSTALL_DIR) -m 755 $(BUILDROOT)$(SYSUSERS_DIR); \
+ $(INSTALL_DATA) cups-sysusers-groups.conf $(BUILDROOT)$(SYSUSERS_DIR)/cups-groups.conf; \
+ fi
#
# Install programs...
@@ -131,3 +139,8 @@ uninstall:
$(RM) $(BUILDROOT)$(PAMDIR)/cups; \
$(RMDIR) $(BUILDROOT)$(PAMDIR); \
fi
+ -if test x$(SYSUSERS_DIR) != x; then \
+ $(RM) $(BUILDROOT)$(SYSUSERS_DIR)/cups.conf; \
+ $(RM) $(BUILDROOT)$(SYSUSERS_DIR)/cups-groups.conf; \
+ $(RMDIR) $(BUILDROOT)$(SYSUSERS_DIR); \
+ fi
diff --git a/conf/cups-sysusers-groups.conf.in b/conf/cups-sysusers-groups.conf.in
new file mode 100644
index 000000000..68223df4e
--- /dev/null
+++ b/conf/cups-sysusers-groups.conf.in
@@ -0,0 +1,3 @@
+# sysusers.d(5) config file for the CUPS administrative group(s).
+
+@CUPS_SYSUSERS_SYSTEM_GROUPS@
diff --git a/conf/cups-sysusers.conf.in b/conf/cups-sysusers.conf.in
new file mode 100644
index 000000000..fdc81a954
--- /dev/null
+++ b/conf/cups-sysusers.conf.in
@@ -0,0 +1,4 @@
+# sysusers.d(5) config file for the CUPS user and group.
+
+@CUPS_SYSUSERS_GROUP@
+@CUPS_SYSUSERS_USER@
diff --git a/config-scripts/cups-defaults.m4 b/config-scripts/cups-defaults.m4
index fc9ba4a02..2c6f020cc 100644
--- a/config-scripts/cups-defaults.m4
+++ b/config-scripts/cups-defaults.m4
@@ -298,6 +298,49 @@ AC_DEFINE_UNQUOTED([CUPS_DEFAULT_USER], ["$CUPS_USER"], [Default User value.])
AC_DEFINE_UNQUOTED([CUPS_DEFAULT_GROUP], ["$CUPS_GROUP"], [Default Group value.])
AC_DEFINE_UNQUOTED([CUPS_DEFAULT_SYSTEM_GROUPS], ["$CUPS_SYSTEM_GROUPS"], [Default SystemGroup value(s).])
+dnl sysusers.d entries for CUPS user and group...
+CUPS_SYSUSERS_GROUP=""
+CUPS_SYSUSERS_USER=""
+AS_IF([test "x$CUPS_USER" != "xroot" -a "x$CUPS_USER" != "xnobody"], [
+ AS_IF([test "x$CUPS_GROUP" != "xroot" -a "x$CUPS_GROUP" != "xnobody" -a "x$CUPS_GROUP" != "xnogroup"], [
+ CUPS_SYSUSERS_USER="u $CUPS_USER -:$CUPS_GROUP \"CUPS printing service\""
+ ], [
+ CUPS_SYSUSERS_USER="u $CUPS_USER - \"CUPS printing service\""
+ ])
+], [
+ AS_IF([test "x$CUPS_GROUP" != "xroot" -a "x$CUPS_GROUP" != "xnobody" -a "x$CUPS_GROUP" != "xnogroup"], [
+ CUPS_SYSUSERS_GROUP="g $CUPS_GROUP"
+ ])
+])
+AC_SUBST([CUPS_SYSUSERS_GROUP])
+AC_SUBST([CUPS_SYSUSERS_USER])
+
+AS_IF([test "x$CUPS_SYSUSERS_USER" != x -o "x$CUPS_SYSUSERS_GROUP" != x], [
+ INSTALL_SYSUSERS="install-sysusers"
+], [
+ INSTALL_SYSUSERS=""
+])
+AC_SUBST([INSTALL_SYSUSERS])
+
+CUPS_SYSUSERS_SYSTEM_GROUPS=""
+for group in $CUPS_SYSTEM_GROUPS; do
+ AS_IF([test "x$group" != "xroot" -a "x$group" != "xnobody" -a "x$group" != "xnogroup"], [
+ AS_IF([test "x$CUPS_SYSUSERS_SYSTEM_GROUPS" = x], [
+ CUPS_SYSUSERS_SYSTEM_GROUPS="g $group"
+ ], [
+ CUPS_SYSUSERS_SYSTEM_GROUPS="$CUPS_SYSUSERS_SYSTEM_GROUPS
+g $group"
+ ])
+ ])
+done
+AC_SUBST([CUPS_SYSUSERS_SYSTEM_GROUPS])
+
+AS_IF([test "x$CUPS_SYSUSERS_SYSTEM_GROUPS" != x], [
+ INSTALL_SYSUSERS_GROUPS="install-sysusers-groups"
+], [
+ INSTALL_SYSUSERS_GROUPS=""
+])
+AC_SUBST([INSTALL_SYSUSERS_GROUPS])
dnl Default printcap file...
AC_ARG_WITH([printcap], AS_HELP_STRING([--with-printcap], [set default printcap file]), [
diff --git a/config-scripts/cups-directories.m4 b/config-scripts/cups-directories.m4
index 069ee7bab..b4c5749a5 100644
--- a/config-scripts/cups-directories.m4
+++ b/config-scripts/cups-directories.m4
@@ -279,3 +279,20 @@ AC_ARG_WITH([rundir], AS_HELP_STRING([--with-rundir], [set transient run-time st
])
AC_DEFINE_UNQUOTED([CUPS_STATEDIR], ["$CUPS_STATEDIR"], [Location of transient state files.])
AC_SUBST([CUPS_STATEDIR])
+
+dnl sysusers.d directory...
+AC_ARG_WITH([sysusersdir], AS_HELP_STRING([--with-sysusersdir], [set directory for sysusers.d config file]), [
+ SYSUSERS_DIR="$withval"
+], [
+ SYSUSERS_DIR=""
+ AS_IF([test "x$PKGCONFIG" != x], [
+ AS_IF([$PKGCONFIG --exists systemd], [
+ SYSUSERS_DIR="$($PKGCONFIG --variable=sysusersdir systemd)"
+ ])
+ ])
+])
+
+AS_IF([test "x$SYSUSERS_DIR" = xno], [
+ SYSUSERS_DIR=""
+])
+AC_SUBST([SYSUSERS_DIR])
diff --git a/configure.ac b/configure.ac
index 444b9d1e7..1ad29db83 100644
--- a/configure.ac
+++ b/configure.ac
@@ -59,6 +59,8 @@ dnl Provide autoconf with a list of files to generate and output them...
AC_CONFIG_FILES([
Makedefs
conf/cups-files.conf
+ conf/cups-sysusers.conf
+ conf/cups-sysusers-groups.conf
conf/cupsd.conf
conf/mime.convs
conf/pam.std
--
2.55.0
File diff suppressed because it is too large Load Diff
+6 -2
View File
@@ -3,7 +3,7 @@ maintainer=""
pkgname=cups
_pkgver=2.4.19
pkgver=9999$_pkgver
pkgrel=1
pkgrel=2
pkgdesc="The CUPS Printing System"
url="https://github.com/OpenPrinting/cups/"
# armhf: pmb#2618
@@ -36,6 +36,8 @@ subpackages="
"
source="$pkgname-$_pkgver.tar.gz::https://github.com/OpenPrinting/cups/archive/v$_pkgver.tar.gz
$pkgname.logrotate
0001-Install-sysusers.d-config-for-user-groups.patch
0002-Regenerate-configure.patch
cups-no-export-ssllibs.patch
cups-nostrip.patch
default-config-no-gssapi.patch
@@ -117,7 +119,7 @@ libs() {
depends=""
replaces="libcups"
amove 'usr/lib/*.so*'
amove usr/lib/*.so*
install -d "$pkgdir"/etc/cups
}
@@ -158,6 +160,8 @@ systemd() {
sha512sums="
e6b084e334d23a4689fc194d6463f30fa391665f1e9d5f89735e91a5b59e5056e03a5c0a8097d0e126133fe8d548ff47ca655be92d84b38ff627823511d54edc cups-2.4.19.tar.gz
bc2e9985b248bdf552306dcaad6ac86ada0053da97a742e57e7d65f0c2373a88edd622b326a39bb536c7aaabc449255d5597001297c9430d237379547c95caf3 cups.logrotate
4b86ca34d1aa2b31513b0a356422de6af8cd6082f3bcc2b7e18fc9e8fe138335ab0bf4ab395e9a816b28f70c91c477e4c720c5186ad22896e2ccb1da39aa85d8 0001-Install-sysusers.d-config-for-user-groups.patch
429d5edc60639521171a56c7dabee44c8d3afe3688575142574fbaa67fada8fc280ae74c80abd5e5abf5aa77770c58e68cb39de918022efb6edee9117759e91e 0002-Regenerate-configure.patch
148eb01f0861e1cd0861a174a5c5262c49b079b27b972b4e90656b9b9357ec710e861604c30e897818f550e9c1cdcefcd8c8bc955ba4a333902a74cdd8dfb5a6 cups-no-export-ssllibs.patch
ca93cd1490e1f17d1ce3a8a5bcf7b9d46a3efaf0cb16c53fc2da779b4ac2eec46fa2a43d1e14d320d410e27618b34744c705a12ca7e7e91fcaee4196a28ac0f6 cups-nostrip.patch
c492f5e20a1bb73cf6bed86d0343659e839df4003aa1409bf608dd3ff05694d1e06ba26fd3786385d2c96dd668485dcef6cfee7f908416a2b125a8e30e82e670 default-config-no-gssapi.patch