]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Use Systemd for Linux family and SysV for other systems. 217/head
authorAndrej Zverev <andrej.zverev@gmail.com>
Wed, 11 Mar 2015 22:25:26 +0000 (01:25 +0300)
committerCharlie Root <root@freebsd11.lan>
Wed, 11 Mar 2015 22:27:57 +0000 (01:27 +0300)
We are creating conf/rspamd.conf.in as template and
declaring two new variables for CMake:
DEFAULTS (for SysV):
 RSPAMD_WORKER_NORMAL = "*:11333"
 RSPAMD_WORKER_CONTROLLER = "*:11334"
For Linux (for Systemd):
 RSPAMD_WORKER_NORMAL = "systemd:0"
 RSPAMD_WORKER_CONTROLLER = "systemd:1"

During build we replace template with correct values.

CMakeLists.txt
conf/rspamd.conf.in [moved from conf/rspamd.conf with 74% similarity]

index afa9f84ac6c37f8ac531a217aed42c0d90481848..ba9d12134add2fa5d4594776272b8a0551ad018d 100644 (file)
@@ -20,6 +20,9 @@ IF(NOT RSPAMD_USER)
        SET(RSPAMD_GROUP "nobody")
 ENDIF(NOT RSPAMD_USER)
 
+# Default for SysV Init
+SET(RSPAMD_WORKER_NORMAL "*:11333")
+SET(RSPAMD_WORKER_CONTROLLER "*:11334")
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)
 SET_PROPERTY(GLOBAL PROPERTY ALLOW_DUPLICATE_CUSTOM_TARGETS 1)
 
@@ -341,6 +344,9 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
        ELSE(EXISTS "/etc/debian_version")
                SET(LINUX_START_SCRIPT "rspamd_rh.in")
        ENDIF(EXISTS "/etc/debian_version")
+       # Overwrite to conform systemd
+       SET(RSPAMD_WORKER_NORMAL "systemd:0")
+       SET(RSPAMD_WORKER_CONTROLLER "systemd:1")
 ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
 
 IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
@@ -389,6 +395,9 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
        SET(CMAKE_INSTALL_RPATH "${PREFIX}/lib")        
 ENDIF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
 
+# Create conf/rspamd.conf from template
+CONFIGURE_FILE(conf/rspamd.conf.in conf/rspamd.conf @ONLY)
+
 # Now find libraries and headers
 
 # Find lua libraries
similarity index 74%
rename from conf/rspamd.conf
rename to conf/rspamd.conf.in
index 06dbe8599e37c0d4b3287910781d926edb7a327a..db0ca90993de17cecccf9774345ff91afe3af152 100644 (file)
@@ -10,11 +10,11 @@ logging {
 }
 
 worker {
-    bind_socket = "systemd:0";
+    bind_socket = "@RSPAMD_WORKER_NORMAL@";
     .include "$CONFDIR/worker-normal.inc"
 }
 
 worker {
-    bind_socket = "systemd:1";
+    bind_socket = "@RSPAMD_WORKER_CONTROLLER@";
     .include "$CONFDIR/worker-controller.inc"
 }