[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140320094355.14878.93423.stgit@localhost.localdomain>
Date: Thu, 20 Mar 2014 15:13:55 +0530
From: Janani Venkataraman <jananive@...ux.vnet.ibm.com>
To: linux-kernel@...r.kernel.org
Cc: amwang@...hat.com, procps@...elists.org, rdunlap@...otime.net,
james.hogan@...tec.com, aravinda@...ux.vnet.ibm.com, hch@....de,
mhiramat@...hat.com, jeremy.fitzhardinge@...rix.com,
xemul@...allels.com, d.hatayama@...fujitsu.com, coreutils@....org,
kosaki.motohiro@...fujitsu.com, adobriyan@...il.com,
util-linux@...r.kernel.org, tarundsk@...ux.vnet.ibm.com,
vapier@...too.org, roland@...k.frob.com, ananth@...ux.vnet.ibm.com,
gorcunov@...nvz.org, avagin@...nvz.org, oleg@...hat.com,
eparis@...hat.com, suzuki@...ux.vnet.ibm.com, andi@...stfloor.org,
tj@...nel.org, akpm@...ux-foundation.org,
torvalds@...ux-foundation.org
Subject: [PATCH 32/33] Socket and Service files.
The socket and service files for systemd are created.
Signed-off-by: Janani Venkataraman <jananive@...ux.vnet.ibm.com>
---
Makefile.am | 15 +++++++++++++++
configure.ac | 1 +
gencore.service | 9 +++++++++
gencore.socket | 10 ++++++++++
gencore.spec.in | 21 +++++++++++++++++++++
gencore@...rvice | 9 +++++++++
6 files changed, 65 insertions(+)
create mode 100644 gencore.service
create mode 100644 gencore.socket
create mode 100644 gencore@...rvice
diff --git a/Makefile.am b/Makefile.am
index 30e86f5..4c6c269 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,5 +3,20 @@ SUBDIRS = src doc
EXTRA_DIST = src/coredump.h src/elf.c src/elf-compat.h doc/gencore.1 doc/gencore.3 Changelog COPYING.LIBGENCORE
+if HAVE_SYSTEMD_SOCKET_SUPPORT
+EXTRA_DIST += gencore.socket gencore@...rvice
+else
+EXTRA_DIST += gencore.service
+endif
+
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libgencore.pc
+
+systemddir = /usr/lib/systemd
+systemdir = /usr/lib/systemd/system
+
+if HAVE_SYSTEMD_SOCKET_SUPPORT
+system_DATA = gencore@...rvice gencore.socket
+else
+system_DATA = gencore.service
+endif
diff --git a/configure.ac b/configure.ac
index 6245ae1..39d7902 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,4 +4,5 @@ AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_CONFIG_HEADERS([config.h])
AC_PROG_CC
AC_CONFIG_FILES(Makefile gencore.spec libgencore.pc)
+AM_CONDITIONAL(HAVE_SYSTEMD_SOCKET_SUPPORT, test "have_systemd_socket_support" = false)
AC_OUTPUT(src/Makefile doc/Makefile)
diff --git a/gencore.service b/gencore.service
new file mode 100644
index 0000000..79220ff
--- /dev/null
+++ b/gencore.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Gencore service
+
+[Service]
+Type=forking
+ExecStart=/usr/bin/gencore --daemon
+
+[Install]
+WantedBy=multi-user.target
diff --git a/gencore.socket b/gencore.socket
new file mode 100644
index 0000000..b9afce8
--- /dev/null
+++ b/gencore.socket
@@ -0,0 +1,10 @@
+[Unit]
+Description=Gencore socket
+
+[Socket]
+ListenStream=/var/run/gencored.socket
+Accept=true
+
+[Install]
+WantedBy=socket.target
+
diff --git a/gencore.spec.in b/gencore.spec.in
index 58c699e..3937edb 100644
--- a/gencore.spec.in
+++ b/gencore.spec.in
@@ -1,3 +1,5 @@
+%define HAVE_SYSTEMD_SOCKET_SUPPORT 0
+
Name: gencore
Version: @VERSION@
Release: 0
@@ -39,10 +41,19 @@ make
%install
make DESTDIR=$RPM_BUILD_ROOT install
+%preun
+systemctl stop gencore.service
+
%files
%doc README COPYING Changelog
%{_bindir}/gencore
%{_mandir}/man1/gencore.1*
+%if %HAVE_SYSTEMD_SOCKET_SUPPORT
+%{_unitdir}/gencore@...rvice
+%{_unitdir}/gencore.socket
+%else
+%{_unitdir}/gencore.service
+%endif
%files -n libgencore
%doc COPYING.LIBGENCORE
@@ -56,6 +67,16 @@ make DESTDIR=$RPM_BUILD_ROOT install
%{_libdir}/libgencore.la
%{_libdir}/pkgconfig/libgencore.pc
+%post
+systemctl --system daemon-reload
+%if %HAVE_SYSTEMD_SOCKET_SUPPORT
+systemctl enable gencore.socket
+systemctl start gencore.socket
+%else
+systemctl enable gencore.service
+systemctl start gencore.service
+%endif
+
%post -n libgencore
ldconfig -n %{_libdir}/libgencore.so.*
diff --git a/gencore@...rvice b/gencore@...rvice
new file mode 100644
index 0000000..4dcfb1c
--- /dev/null
+++ b/gencore@...rvice
@@ -0,0 +1,9 @@
+[Unit]
+Description=Gencore service
+
+[Service]
+Type=forking
+ExecStart=/usr/bin/gencore --socket
+
+[Install]
+WantedBy=multi-user.target
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists