[distcc] systemd conversion.

Jon Ciesla limb at fedoraproject.org
Tue Jan 31 16:24:11 UTC 2012


commit 42aa622d62e1b825e5fb555d8e1b18d3751c63df
Author: Jon Ciesla <limburgher at gmail.com>
Date:   Tue Jan 31 10:24:02 2012 -0600

    systemd conversion.

 distcc.spec     |   58 ++++++++++++++++++++++++++++++++++++++++++++----------
 distccd.service |   11 ++++++++++
 2 files changed, 58 insertions(+), 11 deletions(-)
---
diff --git a/distcc.spec b/distcc.spec
index 88108ae..576070e 100644
--- a/distcc.spec
+++ b/distcc.spec
@@ -5,14 +5,14 @@
 
 Name:       distcc
 Version:    3.1
-Release:    4%{?dist}
+Release:    5%{?dist}
 Summary:    Distributed C/C++ compilation
 Group:      Development/Tools
 License:    GPLv2+
 URL:        http://distcc.org/
 Source0:    http://distcc.googlecode.com/files/distcc-%{version}.tar.bz2
 Source1:    hosts.sample
-Source2:    distccd.init
+Source2:    distccd.service
 #Patch0:     distcc-2.18.3-avahi.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
@@ -36,9 +36,12 @@ Summary:    Server for distributed C/C++ compilation
 Group:      Development/Tools
 License:    GPLv2+
 
-Requires(post): /sbin/chkconfig
-Requires(preun): /sbin/chkconfig
-
+#Requires(post): /sbin/chkconfig
+#Requires(preun): /sbin/chkconfig
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+Requires(post): systemd-sysv
 
 %description server
 This package contains the compilation server needed to use %{name}.
@@ -46,7 +49,7 @@ This package contains the compilation server needed to use %{name}.
 
 %prep
 %setup -q
-#%patch0 -p1 -b .avahi
+#%%patch0 -p1 -b .avahi
 
 
 %build
@@ -70,7 +73,11 @@ install -Dm 0644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/hosts
 install -Dm 0644 contrib/redhat/sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/distccd
 
 # Install distccd init file
-install -Dm 0755 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/init.d/distccd
+#install -Dm 0755 %%{SOURCE2} $RPM_BUILD_ROOT%%{_sysconfdir}/init.d/distccd
+
+# Install distcdd unit file
+mkdir -p $RPM_BUILD_ROOT%{_unitdir}
+install -Dm 0755 %{SOURCE2} $RPM_BUILD_ROOT%{_unitdir}/distccd.service
 
 
 %post
@@ -78,16 +85,41 @@ update-desktop-database &> /dev/null ||:
 
 
 %post server
-[ $1 -lt 2 ] && /sbin/chkconfig --add distccd ||:
-
+#[ $1 -lt 2 ] && /sbin/chkconfig --add distccd ||:
+if [ $1 -eq 1 ] ; then 
+    # Initial installation 
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
 
 %preun server
-[ $1 -eq 0 ] && /sbin/chkconfig --del distccd ||:
+#[ $1 -eq 0 ] && /sbin/chkconfig --del distccd ||:
+if [ $1 -eq 0 ] ; then
+    # Package removal, not upgrade
+    /bin/systemctl --no-reload disable distccd.service > /dev/null 2>&1 || :
+    /bin/systemctl stop distccd.service > /dev/null 2>&1 || :
+fi
+
+%postun server
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+    # Package upgrade, not uninstall
+    /bin/systemctl try-restart distccd.service >/dev/null 2>&1 || :
+fi
 
 
 %postun
 update-desktop-database &> /dev/null ||:
 
+%triggerun -- distcc-server < 3.1-5
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply distccd
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save distccd >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del distccd >/dev/null 2>&1 || :
+/bin/systemctl try-restart distccd.service >/dev/null 2>&1 || :
+
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -112,7 +144,8 @@ rm -rf $RPM_BUILD_ROOT
 %defattr(-,root,root,-)
 %doc COPYING README
 %{_bindir}/distccd
-%{_sysconfdir}/init.d/*
+#%%{_sysconfdir}/init.d/*
+%{_unitdir}/*
 %{_sysconfdir}/default/distcc
 %{_sysconfdir}/distcc/*allow*
 %{_mandir}/man1/distccd*
@@ -122,6 +155,9 @@ rm -rf $RPM_BUILD_ROOT
 %{python_sitearch}/include_server*
 
 %changelog
+* Tue Jan 31 2012 Jon Ciesla <limburgher at gmail.com> - 3.1-5
+- Migrate to systemd, BZ 770409.
+
 * Fri Jan 13 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 3.1-4
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
 
diff --git a/distccd.service b/distccd.service
new file mode 100644
index 0000000..2caedf9
--- /dev/null
+++ b/distccd.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Distccd A Distributed Compilation Server
+After=network.target
+
+[Service]
+User=nobody
+EnvironmentFile=-/etc/sysconfig/distccd
+ExecStart=/usr/bin/distccd --verbose --no-detach --daemon $OPTIONS
+
+[Install]
+WantedBy=multi-user.target


More information about the scm-commits mailing list