[vtun/f13/master] add support for systemd (#661331)

Gabriel L. Somlo somlo at fedoraproject.org
Thu Jan 6 21:19:06 UTC 2011


commit 0bc895118346b177b517cc66a3a7a1338ebde616
Author: Gabriel L. Somlo <somlo at hedwig.ini.cmu.edu>
Date:   Thu Jan 6 16:18:56 2011 -0500

    add support for systemd (#661331)

 vtun.spec     |   23 ++++++++++++++++++++---
 vtund.systemd |   10 ++++++++++
 2 files changed, 30 insertions(+), 3 deletions(-)
---
diff --git a/vtun.spec b/vtun.spec
index 98fdae6..3b5abb1 100644
--- a/vtun.spec
+++ b/vtun.spec
@@ -1,17 +1,21 @@
 Name: vtun
 Version: 3.0.1
-Release: 7%{?dist}
+Release: 9%{?dist}
 Summary: Virtual tunnel over TCP/IP networks
 License: GPLv2+
 Group: System Environment/Daemons
 Url: http://vtun.sourceforge.net
 Source0: http://prdownloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
 Source1: vtund.init
+Source2: vtund.systemd
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Requires: xinetd
 Requires(post): /sbin/chkconfig
-Requires(preun): /sbin/service /sbin/chkconfig
+Requires(preun): /sbin/chkconfig
+Requires(preun): /sbin/service
+Requires(preun): systemd-units
 Requires(postun): /sbin/service 
+Requires(postun): systemd-units
 BuildRequires: zlib-devel lzo-devel openssl-devel bison flex
 
 %description
@@ -34,6 +38,7 @@ require modification to any kernel parts.
 %install
 %{__rm} -rf %{buildroot}
 %{__install} -D -m 0755 -p %{SOURCE1} %{buildroot}/%{_initrddir}/vtund
+%{__install} -D -m 0644 -p %{SOURCE2} %{buildroot}/lib/systemd/system/vtund.service
 %{__install} -D -m 0644 -p scripts/vtund.xinetd %{buildroot}/%{_sysconfdir}/xinetd.d/vtun
 %{__sed} -i 's:/usr/local:%{_prefix}:' %{buildroot}/%{_sysconfdir}/xinetd.d/vtun
 %{__make} install DESTDIR=%{buildroot} INSTALL_OWNER= INSTALL="/usr/bin/install -p"
@@ -50,11 +55,14 @@ fi
 if [ $1 -eq 0 ]; then
 	/sbin/service vtund stop >/dev/null 2>&1 || :
 	/sbin/chkconfig --del vtund || :
+	/bin/systemctl disable vtund.service >/dev/null 2>&1 || :
+	/bin/systemctl stop vtund.service >/dev/null 2>&1 || :
 fi
 
 %postun
 if [ $1 -eq 1 ]; then
 	/sbin/service vtund condrestart >/dev/null 2>&1 || :
+	/bin/systemctl try-restart vtund.service >/dev/null 2>&1 || :
 fi
 
 %files
@@ -63,14 +71,21 @@ fi
 %config(noreplace) %{_sysconfdir}/vtund.conf
 %config(noreplace) %{_sysconfdir}/xinetd.d/vtun
 %{_initrddir}/vtund
+/lib/systemd/system/vtund.service
 %{_sbindir}/vtund
 %dir %{_localstatedir}/log/vtund
-%dir %{_localstatedir}/lock/vtund
+%ghost %dir %{_localstatedir}/lock/vtund
 %{_mandir}/man5/vtund.conf.5*
 %{_mandir}/man8/vtun.8*
 %{_mandir}/man8/vtund.8*
 
 %changelog
+* Thu Jan 06 2011 Gabriel Somlo <somlo at cmu.edu> 3.0.1-9
+- add support for systemd (#661331)
+
+* Tue Nov 30 2010 Gabriel Somlo <somlo at cmu.edu> 3.0.1-8
+- using %ghost on /var/lock/vtund directory (#656720)
+
 * Fri Aug 21 2009 Tomas Mraz <tmraz at redhat.com> - 3.0.1-7
 - rebuilt with new openssl
 
@@ -85,7 +100,9 @@ fi
 
 * Mon Nov 17 2008 Gabriel Somlo <somlo at cmu.edu> 3.0.1-3
 - scriptlets fixes
+
 * Fri Nov 14 2008 Gabriel Somlo <somlo at cmu.edu> 3.0.1-2
 - spec file fixes: defattr, -p flag to install program
+
 * Mon Oct 20 2008 Gabriel Somlo <somlo at cmu.edu> 3.0.1-1
 - initial fedora package
diff --git a/vtund.systemd b/vtund.systemd
new file mode 100644
index 0000000..47f7bc8
--- /dev/null
+++ b/vtund.systemd
@@ -0,0 +1,10 @@
+[Unit]
+Description=virtual tunnel daemon
+After=syslog.target network.target
+
+[Service]
+Type=forking
+ExecStart=/usr/sbin/vtund -s
+
+[Install]
+WantedBy=multi-user.target


More information about the scm-commits mailing list