From 2a2ceb644b2aee050072093e9663cd06d6bfe821 Mon Sep 17 00:00:00 2001 From: Zdenek Dohnal Date: Mon, 15 Mar 2021 13:15:24 +0100 Subject: [PATCH] cups.service.in: Add `SYSTEMD_WANTED_BY` variable The variable contains `printers.target` by default. If CUPS is configured with web interface and browsing enabled, `multi-user.target` is added to the variable. --- CHANGES.md | 2 ++ config-scripts/cups-defaults.m4 | 8 ++++++++ scheduler/cups.service.in | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 3b9d8766a2..29d8ad618c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -27,6 +27,8 @@ CUPS v2.4rc1 (Pending) - Removed support for the (long deprecated and unused) `FontPath`, `LPDConfigFile`, `RIPCache`, and `SMBConfigFile` directives in `cupsd.conf` and `cups-files.conf`. +- Add `SYSTEMD_WANTED_BY` variable for adding different targets into 'WantedBy' + directive in CUPS service file during configuration (Issue #144) CUPS v2.3.3op2 (February 1, 2021) diff --git a/config-scripts/cups-defaults.m4 b/config-scripts/cups-defaults.m4 index d79ba4fbc2..240a952296 100644 --- a/config-scripts/cups-defaults.m4 +++ b/config-scripts/cups-defaults.m4 @@ -9,6 +9,9 @@ dnl Licensed under Apache License v2.0. See the file "LICENSE" for more dnl information. dnl +dnl Set a default systemd WantedBy directive +SYSTEMD_WANTED_BY="printers.target" + dnl Default languages... LANGUAGES="$(ls -1 locale/cups_*.po 2>/dev/null | sed -e '1,$s/locale\/cups_//' -e '1,$s/\.po//' | tr '\n' ' ')" @@ -420,3 +423,8 @@ AS_CASE(["x$enable_webif"], [xno], [ AC_SUBST([CUPS_WEBIF]) AC_DEFINE_UNQUOTED([CUPS_DEFAULT_WEBIF], [$CUPS_DEFAULT_WEBIF], [Default WebInterface value.]) + +AS_IF([test $CUPS_WEBIF = Yes || test $CUPS_BROWSING = Yes], [ + SYSTEMD_WANTED_BY="$SYSTEMD_WANTED_BY multi-user.target"], [ + ]) +AC_SUBST([SYSTEMD_WANTED_BY]) diff --git a/scheduler/cups.service.in b/scheduler/cups.service.in index a3fa0e83fb..db9521931d 100644 --- a/scheduler/cups.service.in +++ b/scheduler/cups.service.in @@ -11,4 +11,4 @@ Restart=on-failure [Install] Also=cups.socket cups.path -WantedBy=printer.target +WantedBy=@SYSTEMD_WANTED_BY@ -- 2.47.2