[cvs] Add support for systemd

Petr Pisar ppisar at fedoraproject.org
Fri Sep 16 13:14:22 UTC 2011


commit 1e66dbbd59ea87b90c1245d3ed3bb515c3f592e0
Author: Petr Písař <ppisar at redhat.com>
Date:   Tue Sep 13 15:25:03 2011 +0200

    Add support for systemd

 cvs.socket   |    9 +++++++++
 cvs.spec     |   35 +++++++++++++++++++++++++++++------
 cvs at .service |    8 ++++++++
 3 files changed, 46 insertions(+), 6 deletions(-)
---
diff --git a/cvs.socket b/cvs.socket
new file mode 100644
index 0000000..04f1d0a
--- /dev/null
+++ b/cvs.socket
@@ -0,0 +1,9 @@
+[Unit]
+Description=CVS Server Activation Socket
+
+[Socket]
+ListenStream=2401
+Accept=true
+
+[Install]
+WantedBy=sockets.target
diff --git a/cvs.spec b/cvs.spec
index d0ae417..852fc1c 100644
--- a/cvs.spec
+++ b/cvs.spec
@@ -5,7 +5,7 @@
 
 Name: cvs
 Version: 1.11.23
-Release: 21%{?dist}
+Release: 22%{?dist}
 Summary: Concurrent Versions System
 Group: Development/Tools
 URL: http://cvs.nongnu.org/
@@ -18,8 +18,11 @@ Source1: cvs.xinetd
 Source2: cvs.pam
 Source3: cvs.sh
 Source4: cvs.csh
-Requires(post): /sbin/install-info
-Requires(preun): /sbin/install-info
+Source5: cvs at .service
+Source6: cvs.socket
+Requires(post): /sbin/install-info, systemd-units
+Requires(preun): /sbin/install-info, systemd-units
+Requires(postun): systemd-units
 Requires: vim-minimal
 BuildRequires: autoconf >= 2.58, automake >= 1.7.9, libtool, zlib-devel
 BuildRequires: vim-minimal
@@ -192,20 +195,36 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/%{name}
 %endif
 install -D -m 644 %{SOURCE3} $RPM_BUILD_ROOT/%{_sysconfdir}/profile.d/cvs.sh
 install -D -m 644 %{SOURCE4} $RPM_BUILD_ROOT/%{_sysconfdir}/profile.d/cvs.csh
+install -p -m 644 -D %{SOURCE5} $RPM_BUILD_ROOT%{_unitdir}/cvs\@.service
+install -p -m 644 -D %{SOURCE6} $RPM_BUILD_ROOT%{_unitdir}/cvs.socket
 
 
 %post
 /sbin/install-info /%{_infodir}/cvs.info.gz /%{_infodir}/dir
 /sbin/install-info /%{_infodir}/cvsclient.info.gz /%{_infodir}/dir
+if [ $1 -eq 1 ] ; then
+    # Initial installation
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
 exit 0
 
 %preun
-if [ $1 = 0 ]; then
-	/sbin/install-info --delete /%{_infodir}/cvs.info.gz /%{_infodir}/dir
-	/sbin/install-info --delete /%{_infodir}/cvsclient.info.gz /%{_infodir}/dir
+if [ $1 -eq 0 ] ; then
+    # Package removal, not upgrade
+    /sbin/install-info --delete /%{_infodir}/cvs.info.gz /%{_infodir}/dir
+    /sbin/install-info --delete /%{_infodir}/cvsclient.info.gz /%{_infodir}/dir
+    /bin/systemctl --no-reload disable cvs\@.service > /dev/null 2>&1 || :
+    /bin/systemctl stop cvs\@.service > /dev/null 2>&1 || :
 fi
 exit 0
 
+%postun
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+    # Package upgrade, not uninstall
+    /bin/systemctl try-restart cvs\@.service >/dev/null 2>&1 || :
+fi
+
 
 %files
 %doc AUTHORS BUGS COPYING* DEVEL-CVS HACKING MINOR-BUGS NEWS
@@ -218,6 +237,7 @@ exit 0
 %config(noreplace) %{_sysconfdir}/pam.d/*
 %endif
 %config(noreplace) %{_sysconfdir}/profile.d/*
+%{_unitdir}/*
 
 %files contrib
 %{_bindir}/rcs2log
@@ -232,6 +252,9 @@ exit 0
 
 
 %changelog
+* Tue Sep 13 2011 Petr Pisar <ppisar at redhat.com> - 1.11.23-22
+- Add support for systemd (bug #737264)
+
 * Mon Aug 15 2011 Kalev Lember <kalevlember at gmail.com> - 1.11.23-21
 - Rebuilt for rpm bug #728707
 
diff --git a/cvs at .service b/cvs at .service
new file mode 100644
index 0000000..e76ef54
--- /dev/null
+++ b/cvs at .service
@@ -0,0 +1,8 @@
+[Unit]
+Description=CVS Server
+After=local-fs.target
+
+[Service]
+Environment=HOME=/var/cvs
+ExecStart=/usr/bin/cvs -f --allow-root=/var/cvs pserver
+StandardInput=socket


More information about the scm-commits mailing list