44 lines
1.5 KiB
Diff
44 lines
1.5 KiB
Diff
From 7940d5311eb0f869bac2e7a9561ba22f69a05424 Mon Sep 17 00:00:00 2001
|
|
From: Christopher Meng <i@cicku.me>
|
|
Date: Sat, 5 Sep 2015 17:14:58 +0800
|
|
Subject: [PATCH] Fix broken conf installation
|
|
|
|
install(SCRIPT) doesn't read variable from project cmakefile, instead of hacking more on this single file with less than 10 lines, why not merge back to one file?
|
|
---
|
|
CMakeLists.txt | 14 ++++++++++++--
|
|
1 file changed, 12 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index d2afb37..6a06cbf 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -124,14 +124,24 @@ add_subdirectory(src)
|
|
|
|
# Install conf files
|
|
|
|
-FILE(GLOB CONF_FILES "${PROJECT_SOURCE_DIR}/conf/*")
|
|
if (RESPECT_INSTALL_PREFIX_CONFIG)
|
|
set(CONFIG_DESTINATION "etc/zmap")
|
|
else()
|
|
set(CONFIG_DESTINATION "/etc/zmap")
|
|
endif()
|
|
|
|
-install(SCRIPT InstallConfFiles.cmake)
|
|
+FILE(GLOB CONF_FILES "${PROJECT_SOURCE_DIR}/conf/*")
|
|
+
|
|
+foreach(EACH_CONF ${CONF_FILES})
|
|
+ get_filename_component(CONF_BASENAME ${EACH_CONF} NAME)
|
|
+ message(STATUS "Default ZMap configuration file location is /etc/zmap")
|
|
+ message(STATUS "Checking if ${CONF_BASENAME} exists there...")
|
|
+ if(NOT EXISTS "/etc/zmap/${CONF_BASENAME}")
|
|
+ install(FILES ${EACH_CONF} DESTINATION ${CONFIG_DESTINATION})
|
|
+ else()
|
|
+ message(WARNING "Existing configuration file detected at /etc/zmap/${CONF_BASENAME}, it will NOT be installed. Please check and install manually!")
|
|
+ endif()
|
|
+endforeach()
|
|
|
|
# Allow Debian Packaging
|
|
INCLUDE (InstallRequiredSystemLibraries)
|
|
--
|
|
2.5.1
|
|
|