[conman] Migrate to systemd.
Jon Ciesla
limb at fedoraproject.org
Tue Apr 17 17:37:17 UTC 2012
commit 129d57dbffe396cdb1cdbc91170fff51dc942c56
Author: Jon Ciesla <limburgher at gmail.com>
Date: Tue Apr 17 12:37:08 2012 -0500
Migrate to systemd.
conman.service | 10 ++++++++++
conman.spec | 47 +++++++++++++++++++++++++++++++++--------------
2 files changed, 43 insertions(+), 14 deletions(-)
---
diff --git a/conman.service b/conman.service
new file mode 100644
index 0000000..2d9a34a
--- /dev/null
+++ b/conman.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=ConMan Console Management Daemon
+After=network.target
+
+[Service]
+Type=forking
+ExecStart=/usr/sbin/conmand -c /etc/conman.conf
+
+[Install]
+WantedBy=multi-user.target
diff --git a/conman.spec b/conman.spec
index ee41a96..3f3ba1c 100644
--- a/conman.spec
+++ b/conman.spec
@@ -1,21 +1,20 @@
Name: conman
Version: 0.2.7
-Release: 0%{?dist}
+Release: 1%{?dist}
Summary: ConMan - The Console Manager
Group: Applications/System
License: GPLv2+
URL: http://home.gna.org/conman/
Source0: http://download.gna.org/%{name}/%{version}/%{name}-%{version}.tar.bz2
-Source1: %{name}.init
+Source1: %{name}.service
Source2: %{name}.logrotate
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: logrotate
-Requires(post): /sbin/chkconfig
-Requires(preun): /sbin/chkconfig
-Requires(preun): /sbin/service
-Requires(postun): /sbin/service
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
BuildRequires: tcp_wrappers
%description
@@ -53,7 +52,8 @@ make %{?_smp_mflags}
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
# put in our own initscript and logrotate
-install -m 0755 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/init.d/%{name}
+install -D -m 0644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/%{name}.service
+rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/init.d
install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/%{name}
# make log directories
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/%{name}
@@ -69,19 +69,35 @@ chmod 644 $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.conf
rm -rf "$RPM_BUILD_ROOT"
%post
-/sbin/chkconfig --add conman
+if [ $1 -eq 1 ] ; then
+ # Initial installation
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
%preun
-if [ "$1" = 0 ]; then
- /sbin/service conman stop >/dev/null 2>&1 || :
- /sbin/chkconfig --del conman
+if [ $1 -eq 0 ] ; then
+ # Package removal, not upgrade
+ /bin/systemctl --no-reload disable conman.service > /dev/null 2>&1 || :
+ /bin/systemctl stop conman.service > /dev/null 2>&1 || :
fi
%postun
-if [ "$1" -ge 1 ]; then
- /sbin/service conman condrestart >/dev/null 2>&1 || :
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+ # Package upgrade, not uninstall
+ /bin/systemctl try-restart conman.service >/dev/null 2>&1 || :
fi
+%triggerun -- conman < 0.2.7-1
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply conman
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save conman >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del conman >/dev/null 2>&1 || :
+/bin/systemctl try-restart conman.service >/dev/null 2>&1 || :
+
%files
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING FAQ NEWS
@@ -89,7 +105,7 @@ fi
%config(noreplace) %{_sysconfdir}/%{name}.conf
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
-%{_sysconfdir}/init.d/%{name}
+%{_unitdir}/%{name}.service
%{_localstatedir}/log/%{name}
%{_localstatedir}/log/%{name}.old
%{_bindir}/*
@@ -98,6 +114,9 @@ fi
%{_mandir}/*/*
%changelog
+* Tue Apr 17 2012 Jon Ciesla <limburgher at gmail.com> - 0.2.7-1
+- Migrate to systemd, BZ 771474.
+
* Sun Apr 15 2012 Steven M. Parrish <smparrish at gmail.com> - 0.2.7-0
- New upstream release
More information about the scm-commits
mailing list