diff --git a/SOURCES/0001-Add-with-idle-exit-timeout-configure-option.patch b/SOURCES/0001-Add-with-idle-exit-timeout-configure-option.patch
new file mode 100644
index 0000000..5a638e1
--- /dev/null
+++ b/SOURCES/0001-Add-with-idle-exit-timeout-configure-option.patch
@@ -0,0 +1,33 @@
+diff -up cups-2.2.6/conf/cupsd.conf.in.idleexittimeout cups-2.2.6/conf/cupsd.conf.in
+--- cups-2.2.6/conf/cupsd.conf.in.idleexittimeout 2017-11-01 15:57:53.000000000 +0100
++++ cups-2.2.6/conf/cupsd.conf.in 2021-11-29 11:45:37.416058954 +0100
+@@ -22,6 +22,9 @@ DefaultAuthType Basic
+ # Web interface setting...
+ WebInterface @CUPS_WEBIF@
+
++# Timeout after cupsd exits if idle (applied only if cupsd runs on-demand - with -l)
++IdleExitTimeout @EXIT_TIMEOUT@
++
+ # Restrict access to the server...
+
+ Order allow,deny
+diff -up cups-2.2.6/config-scripts/cups-defaults.m4.idleexittimeout cups-2.2.6/config-scripts/cups-defaults.m4
+--- cups-2.2.6/config-scripts/cups-defaults.m4.idleexittimeout 2021-11-29 11:45:37.416058954 +0100
++++ cups-2.2.6/config-scripts/cups-defaults.m4 2021-11-29 11:46:31.680612421 +0100
+@@ -425,3 +425,16 @@ esac
+
+ AC_SUBST(CUPS_WEBIF)
+ AC_DEFINE_UNQUOTED(CUPS_DEFAULT_WEBIF, $CUPS_DEFAULT_WEBIF)
++
++dnl Set default value of IdleExitTimeout
++AC_ARG_WITH([idle_exit_timeout], AS_HELP_STRING([--with-idle-exit-timeout], [set the default value for IdleExitTimeout, default=60]), [
++ AS_IF([test "x$withval" = "xno"], [
++ EXIT_TIMEOUT=0
++ ], [
++ EXIT_TIMEOUT=$withval
++ ])
++], [
++ EXIT_TIMEOUT=60
++])
++
++AC_SUBST([EXIT_TIMEOUT])
diff --git a/SOURCES/0001-Add-with-systemd-timeoutstartsec-configure-option.patch b/SOURCES/0001-Add-with-systemd-timeoutstartsec-configure-option.patch
new file mode 100644
index 0000000..af83a6c
--- /dev/null
+++ b/SOURCES/0001-Add-with-systemd-timeoutstartsec-configure-option.patch
@@ -0,0 +1,33 @@
+diff -up cups-2.3.3op2/config-scripts/cups-defaults.m4.conf-timeoutstartsec cups-2.3.3op2/config-scripts/cups-defaults.m4
+--- cups-2.3.3op2/config-scripts/cups-defaults.m4.conf-timeoutstartsec 2021-11-29 13:50:14.568976028 +0100
++++ cups-2.3.3op2/config-scripts/cups-defaults.m4 2021-11-29 13:51:02.785567762 +0100
+@@ -482,3 +482,18 @@ AC_ARG_WITH([idle_exit_timeout], AS_HELP
+ ])
+
+ AC_SUBST([EXIT_TIMEOUT])
++
++dnl set TimeoutStartSec for cups.service
++dnl - if used as --without-*, it sets TimeoutStartSec to infinity
++AC_ARG_WITH([systemd-timeoutstartsec],
++ AS_HELP_STRING([--with-systemd-timeoutstartsec],
++ [set TimeoutStartSec value in cups.service, default=default value in systemd]), [
++ AS_IF([ test "x$withval" = "xno" ], [
++ TIMEOUTSTARTSEC="TimeoutStartSec=infinity"
++ ], [
++ TIMEOUTSTARTSEC="TimeoutStartSec=$withval"
++ ])
++], [
++ TIMEOUTSTARTSEC=""
++])
++AC_SUBST([TIMEOUTSTARTSEC])
+diff -up cups-2.3.3op2/scheduler/org.cups.cupsd.service.in.conf-timeoutstartsec cups-2.3.3op2/scheduler/org.cups.cupsd.service.in
+--- cups-2.3.3op2/scheduler/org.cups.cupsd.service.in.conf-timeoutstartsec 2021-11-29 13:50:14.551976172 +0100
++++ cups-2.3.3op2/scheduler/org.cups.cupsd.service.in 2021-11-29 13:50:14.568976028 +0100
+@@ -8,6 +8,7 @@ Requires=cups.socket
+ ExecStart=@sbindir@/cupsd -l
+ Type=notify
+ Restart=on-failure
++@TIMEOUTSTARTSEC@
+
+ [Install]
+ Also=cups.socket cups.path
diff --git a/SPECS/cups.spec b/SPECS/cups.spec
index 6c68cba..68653e9 100644
--- a/SPECS/cups.spec
+++ b/SPECS/cups.spec
@@ -15,7 +15,7 @@ Summary: CUPS printing system
Name: cups
Epoch: 1
Version: 2.2.6
-Release: 41%{?dist}
+Release: 42%{?dist}
License: GPLv2+ and LGPLv2 with exceptions and AML
Url: http://www.cups.org/
Source0: https://github.com/apple/cups/releases/download/v%{VERSION}/cups-%{VERSION}-source.tar.gz
@@ -123,8 +123,12 @@ Patch67: 0001-scheduler-job.c-use-gziptoany-for-raw-files-not-just.patch
Patch68: cups-restart-job-hold-until.patch
# 1811716 - lpr to non-existent printer reports incorrect error
Patch69: 0001-cups-dests.c-cupsGetNamedDest-set-IPP_STATUS_ERROR_N.patch
+# 2015182 - RFE: Implement IdleExitTimeout configuration during build
+Patch70: 0001-Add-with-idle-exit-timeout-configure-option.patch
+# 2013865 - RFE: Implement TimeoutStartSec configuration during build
+Patch71: 0001-Add-with-systemd-timeoutstartsec-configure-option.patch
-Patch100: cups-lspp.patch
+Patch1000: cups-lspp.patch
Requires: %{name}-filesystem = %{epoch}:%{version}-%{release}
Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
@@ -323,7 +327,7 @@ Sends IPP requests to the specified URI and tests and/or displays the results.
%if %{lspp}
# LSPP support.
-%patch100 -p1 -b .lspp
+%patch1000 -p1 -b .lspp
%endif
# substitute default values for invalid job attributes (upstream #5186 and #5229)
@@ -389,6 +393,10 @@ Sends IPP requests to the specified URI and tests and/or displays the results.
%patch68 -p1 -b .restart-hold-job
# 1811716 - lpr to non-existent printer reports incorrect error
%patch69 -p1 -b .lplpr-better-error
+# 2015182 - RFE: Implement IdleExitTimeout configuration during build
+%patch70 -p1 -b .idleexittimeout
+# 2013865 - RFE: Implement TimeoutStartSec configuration during build
+%patch71 -p1 -b .timeoutstartsec
sed -i -e '1iMaxLogSize 0' conf/cupsd.conf.in
@@ -438,6 +446,10 @@ export CXX=g++
--with-xinetd=no \
--with-access-log-level=actions \
--enable-page-logging \
+%if 0%{?rhel}
+ --without-idle-exit-timeout \
+ --without-systemd-timeoutstartsec \
+%endif
localedir=%{_datadir}/locale
# If we got this far, all prerequisite libraries must be here.
@@ -799,6 +811,12 @@ rm -f %{cups_serverbin}/backend/smb
%{_mandir}/man5/ipptoolfile.5.gz
%changelog
+* Thu Dec 16 2021 Zdenek Dohnal - 1:2.2.6-42
+- 2013865 - RFE: Implement TimeoutStartSec configuration during build
+
+* Mon Nov 29 2021 Zdenek Dohnal - 1:2.2.6-42
+- 2015182 - RFE: Implement IdleExitTimeout configuration during build
+
* Wed Nov 03 2021 Zdenek Dohnal - 1:2.2.6-41
- 2006987 - Unauthenticated users can't move print jobs in Web UI
- 2017919 - Setting 'MaxJobTime 0' does not set a job time to unlimited