]> source.dussan.org Git - rspamd.git/commitdiff
Use Systemd for Linux family and SysV for other systems.
authorAndrej Zverev <andrej.zverev@gmail.com>
Wed, 11 Mar 2015 22:25:26 +0000 (01:25 +0300)
committerAndrew Lewis <nerf@judo.za.org>
Tue, 17 Mar 2015 19:31:35 +0000 (21:31 +0200)
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.

Conflicts:
CMakeLists.txt

CMakeLists.txt
conf/rspamd.conf [deleted file]
conf/rspamd.conf.in [new file with mode: 0644]

index 69ddd7d3d2a8abfbaee535a8f36a8987e0957f10..e12ad0e96cf2fab899d33350db2aa49da26b43fd 100644 (file)
@@ -22,6 +22,9 @@ IF(NOT RSPAMD_USER)
 ENDIF(NOT RSPAMD_USER)
 
 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR)
+# Default for SysV Init
+SET(RSPAMD_WORKER_NORMAL "*:11333")
+SET(RSPAMD_WORKER_CONTROLLER "*:11334")
 SET_PROPERTY(GLOBAL PROPERTY ALLOW_DUPLICATE_CUSTOM_TARGETS 1)
 
 ############################# OPTIONS SECTION #############################################
@@ -346,6 +349,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")
@@ -394,6 +400,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
diff --git a/conf/rspamd.conf b/conf/rspamd.conf
deleted file mode 100644 (file)
index 06dbe85..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-.include "$CONFDIR/common.conf"
-
-options {
-    .include "$CONFDIR/options.inc"
-}
-
-logging {
-    type = "console";
-    .include "$CONFDIR/logging.inc"
-}
-
-worker {
-    bind_socket = "systemd:0";
-    .include "$CONFDIR/worker-normal.inc"
-}
-
-worker {
-    bind_socket = "systemd:1";
-    .include "$CONFDIR/worker-controller.inc"
-}
diff --git a/conf/rspamd.conf.in b/conf/rspamd.conf.in
new file mode 100644 (file)
index 0000000..db0ca90
--- /dev/null
@@ -0,0 +1,20 @@
+.include "$CONFDIR/common.conf"
+
+options {
+    .include "$CONFDIR/options.inc"
+}
+
+logging {
+    type = "console";
+    .include "$CONFDIR/logging.inc"
+}
+
+worker {
+    bind_socket = "@RSPAMD_WORKER_NORMAL@";
+    .include "$CONFDIR/worker-normal.inc"
+}
+
+worker {
+    bind_socket = "@RSPAMD_WORKER_CONTROLLER@";
+    .include "$CONFDIR/worker-controller.inc"
+}