[ebnetd] systemd support. (Jóhann B. Guðmundsson, #737695)

Akira TAGOH tagoh at fedoraproject.org
Mon May 14 07:37:18 UTC 2012


commit bfd4577bad68a2c8d6ecaea2ad4c656c47bfb1e0
Author: Akira TAGOH <tagoh at redhat.com>
Date:   Mon May 14 16:37:14 2012 +0900

    systemd support. (Jóhann B. Guðmundsson, #737695)

 ebhttpd-README.dist |    4 +-
 ebhttpd.socket      |    9 ++++
 ebhttpd.xinetd      |   18 ---------
 ebhttpd at .service    |    8 ++++
 ebnetd.socket       |    9 ++++
 ebnetd.spec         |  106 +++++++++++++++++++++++++++++++++++++++++---------
 ebnetd.xinetd       |   18 ---------
 ebnetd at .service     |    8 ++++
 ndtpd.socket        |    9 ++++
 ndtpd.xinetd        |   17 --------
 ndtpd at .service      |    8 ++++
 11 files changed, 140 insertions(+), 74 deletions(-)
---
diff --git a/ebhttpd-README.dist b/ebhttpd-README.dist
index 445679d..6008a68 100644
--- a/ebhttpd-README.dist
+++ b/ebhttpd-README.dist
@@ -4,8 +4,8 @@ ebhttpd defaults to listen on Port 80 as it's designed to work as web server.
 However ebhttpd doesn't meant to replace other web server with it. so we
 would recommend to change the port before using it.
 
-For xinetd users:
-Just changing the port number in /etc/xinetd.d/ebhttpd would works.
+For systemd users:
+Just changing the port number in /lib/systemd/system/ebhttpd.socket would works.
 
 For users who wants to run as standalone:
 You need to change the http-port number in /etc/ebnetd.conf.
diff --git a/ebhttpd.socket b/ebhttpd.socket
new file mode 100644
index 0000000..8cc62a8
--- /dev/null
+++ b/ebhttpd.socket
@@ -0,0 +1,9 @@
+[Unit]
+Description=EB Library Web Activation Socket
+
+[Socket]
+ListenStream=80
+Accept=yes
+
+[Install]
+WantedBy=sockets.target
diff --git a/ebhttpd at .service b/ebhttpd at .service
new file mode 100644
index 0000000..b5b71b2
--- /dev/null
+++ b/ebhttpd at .service
@@ -0,0 +1,8 @@
+[Unit]
+Description=EB Library Web Server
+After=local-fs.target
+
+[Service]
+Environment=HOME=/var/run/ebnetd
+ExecStart=/usr/sbin/ebhttpd --inetd
+StandardInput=socket
diff --git a/ebnetd.socket b/ebnetd.socket
new file mode 100644
index 0000000..8407226
--- /dev/null
+++ b/ebnetd.socket
@@ -0,0 +1,9 @@
+[Unit]
+Description=EB Library Activation Socket
+
+[Socket]
+ListenStream=22010
+Accept=yes
+
+[Install]
+WantedBy=sockets.target
diff --git a/ebnetd.spec b/ebnetd.spec
index 7f1aa78..4f043c2 100644
--- a/ebnetd.spec
+++ b/ebnetd.spec
@@ -5,18 +5,21 @@
 
 Name:		ebnetd
 Version:	1.0
-Release:	11%{?dist}
+Release:	12%{?dist}
 License:	GPLv2+
 URL:		http://www.sra.co.jp/people/m-kasahr/ebnetd/
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires:	eb-devel
 
 Source0:	ftp://ftp.sra.co.jp/pub/misc/eb/%{name}-%{version}.tar.gz
-Source1:	ebnetd.xinetd
-Source2:	ndtpd.xinetd
-Source3:	ebhttpd.xinetd
-Source4:	ebhttpd-README.dist
-Source5:	%{name}-tmpfiles.conf
+Source1:	ebhttpd-README.dist
+Source2:	%{name}-tmpfiles.conf
+Source11:	ebnetd.socket
+Source12:	ebnetd at .service
+Source21:	ndtpd.socket
+Source22:	ndtpd at .service
+Source31:	ebhttpd.socket
+Source32:	ebhttpd at .service
 Patch0:		ebnetd-1.0-info.patch
 
 
@@ -34,10 +37,10 @@ This package contains a EBNET protocol server.
 %package common
 Summary:		Common package for ebnetd families
 Group:			System Environment/Daemons
-Requires(post):		/sbin/install-info
-Requires(preun):	/sbin/install-info
-Requires(pre):		shadow-utils
-Requires:		xinetd initscripts
+Requires(post):		/sbin/install-info systemd-units
+Requires(preun):	/sbin/install-info systemd-units
+Requires(pre):		shadow-utils systemd-units
+Requires:		initscripts
 
 %description common
 EBNET is a protocol to communicate to the EB library that is a C library
@@ -72,7 +75,7 @@ Note that ebhttpd can't be used for generic WWW purposes.
 %prep
 %setup -q
 %patch0 -p1 -b .0-info
-cp -p %{SOURCE4} .
+cp -p %{SOURCE1} .
 
 %build
 %configure --disable-static --enable-ipv6 --with-eb-conf=%{_libdir}/eb.conf --with-logdir=%{_localstatedir}/log/ebnetd --localstatedir=%{base_homedir}
@@ -85,12 +88,15 @@ rm -rf $RPM_BUILD_ROOT
 make install DESTDIR=$RPM_BUILD_ROOT INSTALL="/usr/bin/install -p"
 
 install -d $RPM_BUILD_ROOT%{_localstatedir}/run/ebnetd
-install -d $RPM_BUILD_ROOT%{_sysconfdir}/xinetd.d
 install -d $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d
-install -p -m0644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/xinetd.d/ebnet
-install -p -m0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/xinetd.d/ndtp
-install -p -m0644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/xinetd.d/http
-install -p -m0644 %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/%{name}.conf
+install -d $RPM_BUILD_ROOT/lib/systemd/system
+install -p -m0644 %{SOURCE11} $RPM_BUILD_ROOT/lib/systemd/system/
+install -p -m0644 %{SOURCE21} $RPM_BUILD_ROOT/lib/systemd/system/
+install -p -m0644 %{SOURCE31} $RPM_BUILD_ROOT/lib/systemd/system/
+install -p -m0644 %{SOURCE12} $RPM_BUILD_ROOT/lib/systemd/system/
+install -p -m0644 %{SOURCE22} $RPM_BUILD_ROOT/lib/systemd/system/
+install -p -m0644 %{SOURCE32} $RPM_BUILD_ROOT/lib/systemd/system/
+install -p -m0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/%{name}.conf
 
 # correct timestamp
 ## for patch0
@@ -116,6 +122,25 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir
 rm -rf $RPM_BUILD_ROOT
 
 
+%post
+if [ $1 -eq 1 ]; then
+	/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
+
+%preun
+if [ $1 -eq 0 ]; then
+	/bin/systemctl --no-reload disable ebnetd.socket > /dev/null 2>&1 || :
+	for i in `/bin/systemctl --full | grep ebnetd | grep running | cut -d' ' -f1`; do
+		/bin/systemctl stop $i 2>&1 || :
+	done
+fi
+
+#%%postun
+#/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+#if [ $1 -ge 1 ]; then
+#	/bin/systemctl try-restart ebnetd.service >/dev/null 2>&1 || :
+#fi
+
 %pre common
 getent group %{username} > /dev/null || groupadd -r %{username}
 getent passwd %{username} > /dev/null || useradd -r -g %{username} -d %{homedir} -s /sbin/nologin -c '%{gecos}' %{username}
@@ -131,6 +156,43 @@ if [ "$1" = 0 ]; then
 	/sbin/install-info --delete %{_infodir}/ebnetd-ja.info %{_infodir}/dir || :
 fi
 
+%post	-n ndtpd
+if [ $1 -eq 1 ]; then
+	/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
+
+%preun	-n ndtpd
+if [ $1 -eq 0 ]; then
+	/bin/systemctl --no-reload disable ndtpd.socket > /dev/null 2>&1 || :
+	for i in `/bin/systemctl --full | grep ndtpd | grep running | cut -d' ' -f1`; do
+		/bin/systemctl stop $i 2>&1 || :
+	done
+fi
+
+#%%postun	-n ndtpd
+#/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+#if [ $1 -ge 1 ]; then
+#	/bin/systemctl try-restart ndtpd.service >/dev/null 2>&1 || :
+#fi
+
+%post	-n ebhttpd
+if [ $1 -eq 1 ]; then
+	/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
+
+%preun	-n ebhttpd
+if [ $1 -eq 0 ]; then
+	/bin/systemctl --no-reload disable ebhttpd.socket > /dev/null 2>&1 || :
+	for i in `/bin/systemctl --full | grep ebhttpd | grep running | cut -d' ' -f1`; do
+		/bin/systemctl stop $i 2>&1 || :
+	done
+fi
+
+#%%postun	-n ebhttpd
+#/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+#if [ $1 -ge 1 ]; then
+#	/bin/systemctl try-restart ebhttpd.service >/dev/null 2>&1 || :
+#fi
 
 %files
 %defattr (-, root, root, -)
@@ -138,7 +200,8 @@ fi
 %{_sbindir}/ebncontrol
 %{_sbindir}/ebncheck
 %{_libexecdir}/ebnstat
-%config(noreplace) %{_sysconfdir}/xinetd.d/ebnet
+/lib/systemd/system/ebnetd.socket
+/lib/systemd/system/ebnetd at .service
 
 %files common
 %defattr (-, root, root, -)
@@ -157,17 +220,22 @@ fi
 %defattr (-, root, root, -)
 %{_sbindir}/ndtp*
 %{_libexecdir}/ndtpstat
-%config(noreplace) %{_sysconfdir}/xinetd.d/ndtp
+/lib/systemd/system/ndtpd.socket
+/lib/systemd/system/ndtpd at .service
 
 %files -n ebhttpd
 %defattr (-, root, root, -)
 %doc ebhttpd-README.dist
 %{_sbindir}/ebht*
 %{_libexecdir}/ebhtstat
-%config(noreplace) %{_sysconfdir}/xinetd.d/http
+/lib/systemd/system/ebhttpd.socket
+/lib/systemd/system/ebhttpd at .service
 
 
 %changelog
+* Mon May 14 2012 Akira TAGOH <tagoh at redhat.com> - 1.0-12
+- systemd support. (Jóhann B. Guðmundsson, #737695)
+
 * Fri Jan 13 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.0-11
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
 
diff --git a/ebnetd at .service b/ebnetd at .service
new file mode 100644
index 0000000..6a4f323
--- /dev/null
+++ b/ebnetd at .service
@@ -0,0 +1,8 @@
+[Unit]
+Description=EB Library Server
+After=local-fs.target
+
+[Service]
+Environment=HOME=/var/run/ebnetd
+ExecStart=/usr/sbin/ebnetd --inetd
+StandardInput=socket
diff --git a/ndtpd.socket b/ndtpd.socket
new file mode 100644
index 0000000..f685095
--- /dev/null
+++ b/ndtpd.socket
@@ -0,0 +1,9 @@
+[Unit]
+Description=EB Library Server
+
+[Socket]
+ListenStream=2882
+Accept=yes
+
+[Install]
+WantedBy=sockets.target
diff --git a/ndtpd at .service b/ndtpd at .service
new file mode 100644
index 0000000..f535cb1
--- /dev/null
+++ b/ndtpd at .service
@@ -0,0 +1,8 @@
+[Unit]
+Description=EB Library Server
+After=local-fs.target
+
+[Service]
+Environment=HOME=/var/run/ebnetd
+ExecStart=/usr/sbin/ndtpd --inetd
+StandardInput=socket


More information about the scm-commits mailing list