[icecream] systemd conversion
Michal Schmidt
michich at fedoraproject.org
Tue Feb 7 00:55:25 UTC 2012
commit 6003afc757bd37cc7bd5181a64e52157ce7106b0
Author: Michal Schmidt <mschmidt at redhat.com>
Date: Tue Feb 7 01:46:07 2012 +0100
systemd conversion
icecc-scheduler-wrapper | 18 ++++++
icecc-scheduler.service | 9 +++
iceccd-wrapper | 24 +++++++
iceccd.service | 12 ++++
icecream-cleanup-conffile.patch | 52 ++++++++--------
icecream.spec | 62 +++++++++++--------
initscript-iceccd | 129 ---------------------------------------
initscript-scheduler | 113 ----------------------------------
8 files changed, 126 insertions(+), 293 deletions(-)
---
diff --git a/icecc-scheduler-wrapper b/icecc-scheduler-wrapper
new file mode 100644
index 0000000..2ac7370
--- /dev/null
+++ b/icecc-scheduler-wrapper
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+logfile="$1"
+
+config=/etc/sysconfig/icecream
+[ -e $config ] && . $config
+
+netname=
+if [ -n "$ICECREAM_NETNAME" ] ; then
+ netname="-n $ICECREAM_NETNAME"
+fi
+
+touch "$logfile"
+chown icecream:icecream "$logfile"
+chmod 0640 "$logfile"
+[ -x /sbin/restorecon ] && /sbin/restorecon "$logfile"
+
+exec /sbin/runuser -s /bin/sh icecream --session-command="/usr/sbin/icecc-scheduler -d -l \"$logfile\" $netname"
diff --git a/icecc-scheduler.service b/icecc-scheduler.service
new file mode 100644
index 0000000..fc66bb3
--- /dev/null
+++ b/icecc-scheduler.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Icecream distributed compiler scheduler
+
+[Service]
+Type=forking
+ExecStart=/usr/lib/icecream/icecc-scheduler-wrapper /var/log/icecc-scheduler
+
+[Install]
+WantedBy=multi-user.target
diff --git a/iceccd-wrapper b/iceccd-wrapper
new file mode 100644
index 0000000..9b89470
--- /dev/null
+++ b/iceccd-wrapper
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+config=/etc/sysconfig/icecream
+[ -e $config ] && . $config
+
+params=""
+if [ -n "$ICECREAM_NETNAME" ] ; then
+ params="$params -n $ICECREAM_NETNAME"
+fi
+if [ -n "$ICECREAM_SCHEDULER_HOST" ] ; then
+ params="$params -s $ICECREAM_SCHEDULER_HOST"
+fi
+if [ "$ICECREAM_ALLOW_REMOTE" = "no" ] ; then
+ params="$params --no-remote"
+fi
+if [ -n "$ICECREAM_MAX_JOBS" ] ; then
+ if [ "$ICECREAM_MAX_JOBS" -eq 0 ] ; then
+ params="$params -m 1"
+ params="$params --no-remote"
+ else
+ params="$params -m $ICECREAM_MAX_JOBS"
+ fi
+fi
+exec /usr/sbin/iceccd "$@" $params
diff --git a/iceccd.service b/iceccd.service
new file mode 100644
index 0000000..bf4049d
--- /dev/null
+++ b/iceccd.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Icecream Distributed Compiler
+After=network.target nss-lookup.target
+
+[Service]
+Type=forking
+PIDFile=/var/run/iceccd.pid
+ExecStart=/usr/lib/icecream/iceccd-wrapper -d -u icecream -b /var/cache/icecream -l /var/log/iceccd
+Nice=5
+
+[Install]
+WantedBy=multi-user.target
diff --git a/icecream-cleanup-conffile.patch b/icecream-cleanup-conffile.patch
index 7bf7c9d..7aacedd 100644
--- a/icecream-cleanup-conffile.patch
+++ b/icecream-cleanup-conffile.patch
@@ -1,6 +1,8 @@
---- suse/sysconfig.icecream.orig 2007-04-12 10:02:33.000000000 +0200
-+++ suse/sysconfig.icecream 2007-07-17 15:50:39.000000000 +0200
-@@ -1,69 +1,34 @@
+Index: suse/sysconfig.icecream
+===================================================================
+--- suse/sysconfig.icecream.orig
++++ suse/sysconfig.icecream
+@@ -1,69 +1,19 @@
#
-## Type: integer(0:19)
-## Path: Applications/icecream
@@ -8,20 +10,20 @@
-## ServiceRestart: icecream
-## Default: 5
-#
- # Nice level of running compilers
- #
- ICECREAM_NICE_LEVEL="5"
-
- #
+-# Nice level of running compilers
+-#
+-ICECREAM_NICE_LEVEL="5"
+-
+-#
-## Type: string
-## Path: Applications/icecream
-## Defaut: /var/log/iceccd
-#
- # icecream daemon log file
- #
- ICECREAM_LOG_FILE="/var/log/iceccd"
-
- #
+-# icecream daemon log file
+-#
+-ICECREAM_LOG_FILE="/var/log/iceccd"
+-
+-#
-## Type: string
-## Path: Applications/icecream
-## Defaut: no
@@ -35,12 +37,11 @@
-## Path: Applications/icecream
-## Defaut: /var/log/icecc_scheduler
-#
- # icecream scheduler log file
- #
+-# icecream scheduler log file
+-#
-ICECREAM_SCHEDULER_LOG_FILE="/var/log/icecc_scheduler"
-+ICECREAM_SCHEDULER_LOG_FILE="/var/log/icecc-scheduler"
-
- #
+-
+-#
-## Type: string
-## Path: Applications/icecream
-## Defaut: ""
@@ -74,7 +75,7 @@
#
# Note: a value of "0" is actually interpreted as "1", however it
# also sets ICECREAM_ALLOW_REMOTE="no".
-@@ -71,22 +36,14 @@ ICECREAM_SCHEDULER_HOST=""
+@@ -71,22 +21,7 @@ ICECREAM_SCHEDULER_HOST=""
ICECREAM_MAX_JOBS=""
#
@@ -86,15 +87,14 @@
# this one.
#
ICECREAM_ALLOW_REMOTE="yes"
-
- #
+-
+-#
-## Type: string
-## Path: Applications/icecream
-## Default: "/var/cache/icecream"
-#
- # This is the directory where the icecream daemon stores the environments
- # it compiles in. In a big network this can grow quite a bit, so use some
- # path if your /tmp is small - but the user icecream has to write to it.
+-# This is the directory where the icecream daemon stores the environments
+-# it compiles in. In a big network this can grow quite a bit, so use some
+-# path if your /tmp is small - but the user icecream has to write to it.
-#
-+#
- ICECREAM_BASEDIR="/var/cache/icecream"
+-ICECREAM_BASEDIR="/var/cache/icecream"
diff --git a/icecream.spec b/icecream.spec
index 325fc94..f6b8764 100644
--- a/icecream.spec
+++ b/icecream.spec
@@ -7,7 +7,7 @@
Name: icecream
Version: 0.9.7
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Distributed compiler
Group: Development/Tools
@@ -19,21 +19,23 @@ Source2: icecream.csh.in
Source3: icecream.fc
Source4: icecream.te
Source5: icecream.if
-Source6: initscript-iceccd
-Source7: initscript-scheduler
+Source6: iceccd.service
+Source7: icecc-scheduler.service
# tarball extracted from http://download.opensuse.org/repositories/home:/coolo/openSUSE_Factory/src/icecream-0.9.5-3.1.src.rpm:
Source8: %{name}-manpages.tar.bz2
+Source9: iceccd-wrapper
+Source10: icecc-scheduler-wrapper
Patch0: %{name}-rename-scheduler.patch
Patch1: %{name}-cleanup-conffile.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildRequires: symlinks
+BuildRequires: symlinks systemd-units
Requires(pre): shadow-utils
-Requires(post): chkconfig
-Requires(preun): chkconfig initscripts
-Requires(postun): initscripts
+Requires(post): systemd-units systemd-sysv
+Requires(preun): systemd-units
+Requires(postun): systemd-units
%if %{with selinux}
# For SELinux protection:
@@ -77,7 +79,7 @@ sed -e 's|@LIBDIR@|%{_libdir}|g' %{SOURCE2} > icecream.csh
mkdir SELinux
cp -p %{SOURCE3} %{SOURCE4} %{SOURCE5} SELinux
mkdir fedora
-cp -p %{SOURCE6} %{SOURCE7} fedora
+cp -p %{SOURCE6} %{SOURCE7} %{SOURCE9} %{SOURCE10} fedora
%build
%configure --disable-static --enable-shared
@@ -120,10 +122,11 @@ for i in mans/*.1 mans/*.7; do
done
# install config file and initscripts
-install -D -m 644 suse/sysconfig.icecream %{buildroot}/%{_sysconfdir}/sysconfig/icecream
-install -D -m 755 fedora/initscript-iceccd %{buildroot}/%{_sysconfdir}/rc.d/init.d/iceccd
-install -D -m 755 fedora/initscript-scheduler \
- %{buildroot}/%{_sysconfdir}/rc.d/init.d/icecc-scheduler
+install -D -m 644 suse/sysconfig.icecream %{buildroot}/%{_sysconfdir}/sysconfig/icecream
+install -d -m 755 %{buildroot}/%{_unitdir}
+install -p -m 644 fedora/*.service %{buildroot}/%{_unitdir}
+install -d -m 755 %{buildroot}/%{_prefix}/lib/icecream
+install -p -m 755 fedora/*-wrapper %{buildroot}/%{_prefix}/lib/icecream
install -d -m 755 %{buildroot}/%{_sysconfdir}/profile.d
install -p -m 644 icecream.sh icecream.csh %{buildroot}/%{_sysconfdir}/profile.d
@@ -191,16 +194,15 @@ restorecon %{_localstatedir}/log/iceccd 2>/dev/null ||:
%endif
# fi
-/sbin/chkconfig --add iceccd
-/sbin/chkconfig --add icecc-scheduler
+if [ $1 -eq 1 ] ; then # Initial installation
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
exit 0
%preun
-if [ "$1" -eq 0 ]; then # Final removal
- /sbin/service iceccd stop > /dev/null 2>&1
- /sbin/service icecc-scheduler stop > /dev/null 2>&1
- /sbin/chkconfig --del iceccd
- /sbin/chkconfig --del icecc-scheduler
+if [ $1 -eq 0 ]; then # Final removal
+ /bin/systemctl --no-reload disable iceccd.service icecc-scheduler.service > /dev/null 2>&1 || :
+ /bin/systemctl stop iceccd.service icecc-scheduler.service > /dev/null 2>&1 || :
# rm -rf %{_localstatedir}/cache/icecream
%if %{with selinux}
@@ -218,12 +220,12 @@ exit 0
%postun
/sbin/ldconfig
-if [ "$1" -ge 1 ]; then # Upgrade
- /sbin/service iceccd condrestart > /dev/null 2>&1
- /sbin/service icecc-scheduler condrestart > /dev/null 2>&1
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ]; then # Upgrade
+ /bin/systemctl try-restart iceccd.service icecc-scheduler.service >/dev/null 2>&1 || :
fi
%if %{with selinux}
-if [ "$1" -eq 0 ]; then # Final removal
+if [ $1 -eq 0 ]; then # Final removal
for selinuxvariant in %{selinux_variants}; do
semodule -s ${selinuxvariant} -r icecream 2>/dev/null ||:
%relabel ${selinuxvariant}
@@ -232,6 +234,13 @@ fi
%endif
exit 0
+%triggerun -- icecream < 0.9.7-2
+/usr/bin/systemd-sysv-convert --save iceccd >/dev/null 2>&1 ||:
+/usr/bin/systemd-sysv-convert --save icecc-scheduler >/dev/null 2>&1 ||:
+/sbin/chkconfig --del iceccd >/dev/null 2>&1 || :
+/sbin/chkconfig --del icecc-scheduler >/dev/null 2>&1 || :
+/bin/systemctl try-restart iceccd.service icecc-scheduler.service >/dev/null 2>&1 || :
+
%clean
rm -rf %{buildroot}
@@ -252,8 +261,8 @@ rm -rf %{buildroot}
%{_sbindir}/icecc-scheduler
%config(noreplace) %{_sysconfdir}/sysconfig/icecream
%config(noreplace) %{_sysconfdir}/profile.d/icecream.*sh
-%{_sysconfdir}/rc.d/init.d/iceccd
-%{_sysconfdir}/rc.d/init.d/icecc-scheduler
+%{_unitdir}/icecc*.service
+%{_prefix}/lib/icecream
%{_localstatedir}/cache/icecream
%{_mandir}/man*/*
%{?with_selinux:%{_datadir}/selinux/*/icecream.pp}
@@ -266,6 +275,9 @@ rm -rf %{buildroot}
%{_libdir}/pkgconfig/icecc.pc
%changelog
+* Tue Feb 07 2012 Michal Schmidt <mschmidt at redhat.com> - 0.9.7-2
+- systemd conversion
+
* Mon Feb 06 2012 Michal Schmidt <mschmidt at redhat.com> - 0.9.7-1
- Upstream release 0.9.7.
More information about the scm-commits
mailing list