Blame SOURCES/openscap-1.3.7-PR-1876-disable-oscap-remediate.patch

4f92d0
From 140d60bc751e6c0e4138ab3a2e8e9b130264f905 Mon Sep 17 00:00:00 2001
4f92d0
From: =?UTF-8?q?Jan=20=C4=8Cern=C3=BD?= <jcerny@redhat.com>
4f92d0
Date: Wed, 27 Jul 2022 09:40:29 +0200
4f92d0
Subject: [PATCH] Add CMake option to disable oscap-remediate service
4f92d0
4f92d0
This patch introduces a new CMake build option
4f92d0
ENABLE_OSCAP_REMEDIATE_SERVICE which can be used to disable the
4f92d0
installation of the files related to the oscap-remediate systemd
4f92d0
service. Downstream packagers can use this option to disable shipping
4f92d0
the oscap-remediate service in their RPM spec files.
4f92d0
4f92d0
Resolves: rhbz#2111358
4f92d0
Resolves: rhbz#2111360
4f92d0
---
4f92d0
 CMakeLists.txt       | 15 +++++++++------
4f92d0
 utils/CMakeLists.txt | 20 +++++++++++---------
4f92d0
 2 files changed, 20 insertions(+), 15 deletions(-)
4f92d0
4f92d0
diff --git a/CMakeLists.txt b/CMakeLists.txt
4f92d0
index 61c57d7a3e..48e19e5203 100644
4f92d0
--- a/CMakeLists.txt
4f92d0
+++ b/CMakeLists.txt
4f92d0
@@ -327,6 +327,7 @@ cmake_dependent_option(ENABLE_OSCAP_UTIL_VM "enables the oscap-vm utility, this
4f92d0
 cmake_dependent_option(ENABLE_OSCAP_UTIL_PODMAN "enables the oscap-podman utility, this lets you scan Podman containers and container images" ON "NOT WIN32" OFF)
4f92d0
 cmake_dependent_option(ENABLE_OSCAP_UTIL_CHROOT "enables the oscap-chroot utility, this lets you scan entire chroots using offline scanning" ON "NOT WIN32" OFF)
4f92d0
 option(ENABLE_OSCAP_UTIL_AUTOTAILOR "enables the autotailor utility that is able to perform command-line tailoring" TRUE)
4f92d0
+option(ENABLE_OSCAP_REMEDIATE_SERVICE "enables the oscap-remediate service" TRUE)
4f92d0
 
4f92d0
 # ---------- TEST-SUITE SWITCHES
4f92d0
 
4f92d0
@@ -609,12 +610,14 @@ if(NOT WIN32)
4f92d0
 		DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
4f92d0
 	)
4f92d0
 	if(WITH_SYSTEMD)
4f92d0
-		# systemd service for offline (boot-time) remediation
4f92d0
-		configure_file("oscap-remediate.service.in" "oscap-remediate.service" @ONLY)
4f92d0
-		install(FILES
4f92d0
-			${CMAKE_CURRENT_BINARY_DIR}/oscap-remediate.service
4f92d0
-			DESTINATION ${SYSTEMD_UNITDIR}
4f92d0
-		)
4f92d0
+		if(ENABLE_OSCAP_REMEDIATE_SERVICE)
4f92d0
+			# systemd service for offline (boot-time) remediation
4f92d0
+			configure_file("oscap-remediate.service.in" "oscap-remediate.service" @ONLY)
4f92d0
+			install(FILES
4f92d0
+				${CMAKE_CURRENT_BINARY_DIR}/oscap-remediate.service
4f92d0
+				DESTINATION ${SYSTEMD_UNITDIR}
4f92d0
+			)
4f92d0
+		endif()
4f92d0
 	endif()
4f92d0
 endif()
4f92d0
 
4f92d0
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
4f92d0
index 3f199eaabc..93ce1f2a9d 100644
4f92d0
--- a/utils/CMakeLists.txt
4f92d0
+++ b/utils/CMakeLists.txt
4f92d0
@@ -59,15 +59,17 @@ if(ENABLE_OSCAP_UTIL)
4f92d0
 		)
4f92d0
 
4f92d0
 		if(WITH_SYSTEMD)
4f92d0
-			install(PROGRAMS "oscap-remediate"
4f92d0
-				DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}
4f92d0
-			)
4f92d0
-			install(PROGRAMS "oscap-remediate-offline"
4f92d0
-				DESTINATION ${CMAKE_INSTALL_BINDIR}
4f92d0
-			)
4f92d0
-			install(FILES "oscap-remediate-offline.8"
4f92d0
-				DESTINATION "${CMAKE_INSTALL_MANDIR}/man8"
4f92d0
-			)
4f92d0
+			if (ENABLE_OSCAP_REMEDIATE_SERVICE)
4f92d0
+				install(PROGRAMS "oscap-remediate"
4f92d0
+					DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}
4f92d0
+				)
4f92d0
+				install(PROGRAMS "oscap-remediate-offline"
4f92d0
+					DESTINATION ${CMAKE_INSTALL_BINDIR}
4f92d0
+				)
4f92d0
+				install(FILES "oscap-remediate-offline.8"
4f92d0
+					DESTINATION "${CMAKE_INSTALL_MANDIR}/man8"
4f92d0
+				)
4f92d0
+			endif()
4f92d0
 		endif()
4f92d0
 	endif()
4f92d0
 endif()