summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Bentele2020-10-22 19:00:52 +0200
committerManuel Bentele2020-10-22 19:00:52 +0200
commitb5445d3fae2fca61ed036a4e88f061903965db7a (patch)
treebf4770318a5679d41d8993ac8bb435b14f2dbda0
parent[BUILD] add CMake targets to build binary and source packages with CPack (diff)
downloaddnbd3-b5445d3fae2fca61ed036a4e88f061903965db7a.tar.gz
dnbd3-b5445d3fae2fca61ed036a4e88f061903965db7a.tar.xz
dnbd3-b5445d3fae2fca61ed036a4e88f061903965db7a.zip
[BUILD] add systemd service file for dnbd3-server to installation targets
-rw-r--r--CMakeLists.txt10
-rw-r--r--pkg/CMakeLists.txt7
-rw-r--r--pkg/config/CMakeLists.txt (renamed from conf/CMakeLists.txt)7
-rw-r--r--pkg/config/alt-servers (renamed from conf/alt-servers)0
-rw-r--r--pkg/config/rpc.acl (renamed from conf/rpc.acl)0
-rw-r--r--pkg/config/server.conf (renamed from conf/server.conf)0
-rw-r--r--pkg/systemd/CMakeLists.txt12
-rw-r--r--pkg/systemd/dnbd3-server.service12
8 files changed, 42 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dae49c6..fcdc6b7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -161,7 +161,11 @@ if(CMAKE_BUILD_TYPE MATCHES Release)
"/lib/modules"
"/lib/modules/${CMAKE_SYSTEM_VERSION}"
"/lib/modules/${CMAKE_SYSTEM_VERSION}/extra"
- "/etc")
+ "/etc"
+ "/usr"
+ "/usr/lib"
+ "/usr/lib/systemd"
+ "/usr/lib/systemd/system")
if(DNBD3_KERNEL_MODULE)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/package/rpm/post "depmod -a\n")
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/package/rpm/postun "depmod -a\n")
@@ -195,5 +199,5 @@ endif(CMAKE_BUILD_TYPE MATCHES Release)
# add all dnbd3 related projects from the source code directory
add_subdirectory(src)
-# add configuration files for packaging purposes
-add_subdirectory(conf)
+# add configuration and operational files for packaging purposes
+add_subdirectory(pkg)
diff --git a/pkg/CMakeLists.txt b/pkg/CMakeLists.txt
new file mode 100644
index 0000000..3112696
--- /dev/null
+++ b/pkg/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 3.10)
+
+# set the project name
+project(dnbd3-pkg)
+
+add_subdirectory(config)
+add_subdirectory(systemd)
diff --git a/conf/CMakeLists.txt b/pkg/config/CMakeLists.txt
index 1b888e6..1d553db 100644
--- a/conf/CMakeLists.txt
+++ b/pkg/config/CMakeLists.txt
@@ -1,13 +1,14 @@
cmake_minimum_required(VERSION 3.10)
# set the project name
-project(dnbd3-conf)
+project(dnbd3-config)
# define all configuration files
-set(DNBD3_CONF_FILES ${CMAKE_CURRENT_SOURCE_DIR}/alt-servers
+set(DNBD3_CONFIG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/alt-servers
${CMAKE_CURRENT_SOURCE_DIR}/rpc.acl
${CMAKE_CURRENT_SOURCE_DIR}/server.conf)
# install configuration files into sample directory
-install(FILES ${DNBD3_CONF_FILES} DESTINATION /etc/dnbd3-server/sample
+install(FILES ${DNBD3_CONFIG_FILES}
+ DESTINATION /etc/dnbd3-server/sample
COMPONENT server)
diff --git a/conf/alt-servers b/pkg/config/alt-servers
index b26fe79..b26fe79 100644
--- a/conf/alt-servers
+++ b/pkg/config/alt-servers
diff --git a/conf/rpc.acl b/pkg/config/rpc.acl
index b2c2c44..b2c2c44 100644
--- a/conf/rpc.acl
+++ b/pkg/config/rpc.acl
diff --git a/conf/server.conf b/pkg/config/server.conf
index 5f0b2a0..5f0b2a0 100644
--- a/conf/server.conf
+++ b/pkg/config/server.conf
diff --git a/pkg/systemd/CMakeLists.txt b/pkg/systemd/CMakeLists.txt
new file mode 100644
index 0000000..d1e5087
--- /dev/null
+++ b/pkg/systemd/CMakeLists.txt
@@ -0,0 +1,12 @@
+cmake_minimum_required(VERSION 3.10)
+
+# set the project name
+project(dnbd3-systemd)
+
+# define all systemd related files
+set(DNBD3_SYSTEMD_FILES ${CMAKE_CURRENT_SOURCE_DIR}/dnbd3-server.service)
+
+# install systemd service files
+install(FILES ${DNBD3_SYSTEMD_FILES}
+ DESTINATION /usr/lib/systemd/system
+ COMPONENT server)
diff --git a/pkg/systemd/dnbd3-server.service b/pkg/systemd/dnbd3-server.service
new file mode 100644
index 0000000..de800ce
--- /dev/null
+++ b/pkg/systemd/dnbd3-server.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=DNBD3 server
+Wants=network-online.target
+After=network-online.target
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/dnbd3-server -n -c /etc/dnbd3-server
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target