summaryrefslogtreecommitdiff
path: root/uhub/0004-Conditionally-install-systemd-support-files.patch
blob: 9accb57c83bb1a4fe4dd8890217a5b2c0dd258d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From f645797aeced86ce78d2ad7d0c9cf869e1200b3a Mon Sep 17 00:00:00 2001
From: "Christoph J. Thompson" <cjsthompson@gmail.com>
Date: Sat, 13 Dec 2014 23:09:53 +0100
Subject: [PATCH 4/5] * Conditionally install systemd support files

	modified:   CMakeLists.txt
	new file:   doc/uhub.service
	new file:   doc/uhub.tmpfiles
---
 CMakeLists.txt    |  7 +++++++
 doc/uhub.service  | 16 ++++++++++++++++
 doc/uhub.tmpfiles |  1 +
 3 files changed, 24 insertions(+)
 create mode 100644 doc/uhub.service
 create mode 100644 doc/uhub.tmpfiles

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c879185..d08310e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -251,5 +251,12 @@ if (UNIX)
 	install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.conf ${CMAKE_SOURCE_DIR}/plugins.conf ${CMAKE_SOURCE_DIR}/doc/rules.txt ${CMAKE_SOURCE_DIR}/doc/motd.txt DESTINATION /etc/uhub/ OPTIONAL )
 	install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.1 ${CMAKE_SOURCE_DIR}/doc/uhub-passwd.1 DESTINATION ${INSTALL_MAN_DIR}/man1/ OPTIONAL )
 	install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.logrotate DESTINATION /etc/logrotate.d/ RENAME uhub OPTIONAL )
+
+	if(SYSTEMD_SUPPORT)
+		install ( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.service DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/systemd/system/ OPTIONAL )
+		install ( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.tmpfiles DESTINATION
+${CMAKE_INSTALL_PREFIX}/lib/tmpfiles.d/ RENAME uhub.conf OPTIONAL )
+	endif()
+
 endif()
 
diff --git a/doc/uhub.service b/doc/uhub.service
new file mode 100644
index 0000000..24d922d
--- /dev/null
+++ b/doc/uhub.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=uHub ADC hub Server
+Documentation=man:uhub(1)
+After=network.target
+
+[Service]
+Type=simple
+User=uhub
+ExecStart=/usr/bin/uhub -p /run/uhub/uhub.pid
+ExecReload=/usr/bin/uhub -C ; \
+           /bin/kill -HUP $MAINPID
+StandardError=journal
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/doc/uhub.tmpfiles b/doc/uhub.tmpfiles
new file mode 100644
index 0000000..c548637
--- /dev/null
+++ b/doc/uhub.tmpfiles
@@ -0,0 +1 @@
+d /run/uhub 0755 uhub uhub
-- 
2.1.3