backport setting multi-user.target via configure, not via drop-in

This commit is contained in:
Zdenek Dohnal 2021-04-14 12:50:26 +02:00
parent 1cf873fe1d
commit 2f930c8c15
2 changed files with 38 additions and 10 deletions

View File

@ -0,0 +1,33 @@
diff --git a/config-scripts/cups-defaults.m4 b/config-scripts/cups-defaults.m4
index 9e05bd4..505d272 100644
--- a/config-scripts/cups-defaults.m4
+++ b/config-scripts/cups-defaults.m4
@@ -8,6 +8,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' ' '`"
@@ -461,3 +464,8 @@ esac
AC_SUBST(CUPS_WEBIF)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_WEBIF, $CUPS_DEFAULT_WEBIF)
+
+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 baff51b..f0d7e2f 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@

View File

@ -81,6 +81,8 @@ Patch16: cups-nssuserlookup-target.patch
# 1949068 - Print queue is paused after ipp backend ends with CUPS_BACKEND_STOP
# https://github.com/OpenPrinting/cups/pull/132
Patch17: 0001-Retry-Validate-Job-once-if-needed-Issue-132.patch
# https://github.com/OpenPrinting/cups/pull/143
Patch18: 0001-cups.service.in-Add-SYSTEMD_WANTED_BY-variable.patch
##### Patches removed because IMHO they aren't no longer needed
##### but still I'll leave them in git in case their removal
@ -290,6 +292,8 @@ to CUPS daemon. This solution will substitute printer drivers and raw queues in
%patch16 -p1 -b .nssuserlookup-target
# 1949068 - Print queue is paused after ipp backend ends with CUPS_BACKEND_STOP
%patch17 -p1 -b .validate-retry
# put multi-user.target into service file if configured with web interface
%patch18 -p1 -b .multiuser-target
%if %{lspp}
@ -422,14 +426,6 @@ c /dev/lp2 0660 root lp - 6:2
c /dev/lp3 0660 root lp - 6:3
EOF
# create server.conf into cups.service.d directory. The file is needed
# to automatically start cups.service during startup if enabled
mkdir -p %{buildroot}%{_unitdir}/cups.service.d
cat > %{buildroot}%{_unitdir}/cups.service.d/server.conf <<EOF
[Install]
WantedBy=multi-user.target
EOF
find %{buildroot} -type f -o -type l | sed '
s:.*\('%{_datadir}'/\)\([^/_]\+\)\(.*\.po$\):%lang(\2) \1\2\3:
/^%lang(C)/d
@ -623,8 +619,6 @@ rm -f %{cups_serverbin}/backend/smb
%config(noreplace) %{_sysconfdir}/pam.d/cups
%{_tmpfilesdir}/cups.conf
%{_tmpfilesdir}/cups-lp.conf
%dir %{_unitdir}/%{name}.service.d
%attr(0644, root, root)%{_unitdir}/%{name}.service.d/server.conf
%attr(0644, root, root)%{_unitdir}/%{name}.service
%attr(0644, root, root)%{_unitdir}/%{name}.socket
%attr(0644, root, root)%{_unitdir}/%{name}.path
@ -691,6 +685,7 @@ rm -f %{cups_serverbin}/backend/smb
- 1935318 - old samsung USB devices malfunction with the current (250ms) timeout for usb bulk transaction
- 1949054 - Use nss-user-lookup.target instead of sssd.service and ypbind.service
- 1949068 - Print queue is paused after ipp backend ends with CUPS_BACKEND_STOP
- backport setting multi-user.target via configure, not via drop-in
* Mon Mar 22 2021 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.3.3op2-3
- add [Job N] in logs for better debugging