File Fixes-autotools-on-systemd-based-systems.patch of Package leafnode2

From 955bfc116b0e278581f283a71965e8394c1d7351 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= <mcepl@cepl.eu>
Date: Sat, 27 Dec 2014 20:36:43 +0100
Subject: [PATCH] Fixes autotools on systemd-based systems.

---
 Makefile.am                  | 12 ++++++++++--
 systemd/leafnode.socket      |  9 +++++++++
 systemd/leafnode@.service.in |  8 ++++++++
 3 files changed, 27 insertions(+), 2 deletions(-)
 create mode 100644 systemd/leafnode.socket
 create mode 100644 systemd/leafnode@.service.in

diff --git a/Makefile.am b/Makefile.am
index 5c2faa4..3ce62ee 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -224,13 +224,16 @@ EXTRA_DIST = \
 	tools/README \
 	tools/sendbatch.bash.in \
 	tools/simple-batcher.sh \
-	$(GENERATED_MANS)
+	$(GENERATED_MANS) \
+	systemd/leafnode@.service.in  \
+	systemd/leafnode.socket
 
 BUILT_SOURCES = \
 	config.c \
 	configparam_data.c \
 	config_defs.h \
-	config_paths.h
+	config_paths.h \
+	systemd/leafnode@.service
 
 config_paths.h: Makefile
 	echo >$@  '#define GZIP  ((const char *)"$(GZIP)")' && \
@@ -286,6 +289,7 @@ config.c: Makefile
 	@echo >>.$@ " */"
 	@echo >>.$@ "#include \"leafnode.h\""
 	@echo >>.$@ "const char *bindir = \"$(bindir)\";"
+	@echo >>.$@ "const char *sbindir = \"$(sbindir)\";"
 	@echo >>.$@ "const char *def_spooldir = \"$(SPOOLDIR)\";"
 	@echo >>.$@ "const char *sysconfdir = \"$(sysconfdir)\";"
 	@echo >>.$@ "const char *version = \"@VERSION@\";"
@@ -297,6 +301,10 @@ config_defs.h: $(srcdir)/config.table $(srcdir)/configparam.h genconfigdefs.awk
 	$(AWK) -F, -f $(srcdir)/genconfigdefs.awk \
 	<$(srcdir)/config.table >$@ || { rm -f $@ ; false; }
 
+systemd/leafnode@.service: $(srcdir)/systemd/leafnode@.service.in Makefile
+	$(MKDIR_P) systemd
+	$(SED) -e 's}[@]sbindir@}$(sbindir)}g' <$(srcdir)/systemd/leafnode@.service.in >$@ || { rm -f "$@" ; false ; }
+
 configparam_data.c: $(srcdir)/config.table b_sortnl$(EXEEXT) genconfigparam_data.awk
 	rm -f config.table.sorted
 	./b_sortnl$(EXEEXT) <$(srcdir)/config.table >config.table.sorted
diff --git a/systemd/leafnode.socket b/systemd/leafnode.socket
new file mode 100644
index 0000000..10ba056
--- /dev/null
+++ b/systemd/leafnode.socket
@@ -0,0 +1,9 @@
+[Unit]
+Description=NNTP server for small sites (socket)
+
+[Socket]
+ListenStream=119
+Accept=yes
+
+[Install]
+WantedBy=sockets.target
diff --git a/systemd/leafnode@.service.in b/systemd/leafnode@.service.in
new file mode 100644
index 0000000..1a8c637
--- /dev/null
+++ b/systemd/leafnode@.service.in
@@ -0,0 +1,8 @@
+[Unit]
+Description=NNTP server for small sites
+Documentation=man:leafnode(8)
+
+[Service]
+ExecStart=@sbindir@/leafnode
+StandardInput=socket
+User=news
-- 
1.8.3.1