[speech-dispatcher] Introduce systemd unit file, drop SysV support
Toshio くらとみ
toshio at fedoraproject.org
Tue Jul 26 19:47:36 UTC 2011
commit a986ad2bcc978869c2da030bfe26038e7f3058f7
Author: Toshio Kuratomi <toshio at fedoraproject.org>
Date: Tue Jul 26 12:47:22 2011 -0700
Introduce systemd unit file, drop SysV support
speech-dispatcher.spec | 51 +++++++++++++++++++++++++++++++++--------------
1 files changed, 36 insertions(+), 15 deletions(-)
---
diff --git a/speech-dispatcher.spec b/speech-dispatcher.spec
index c12c5ec..12a7edd 100644
--- a/speech-dispatcher.spec
+++ b/speech-dispatcher.spec
@@ -3,7 +3,7 @@
Name: speech-dispatcher
Version: 0.7.1
-Release: 5%{?dist}
+Release: 6%{?dist}
Summary: To provide a high-level device independent layer for speech synthesis
Group: System Environment/Libraries
@@ -13,8 +13,7 @@ Group: System Environment/Libraries
License: GPLv2+ and GPLv2
URL: http://www.freebsoft.org/speechd
Source0: http://www.freebsoft.org/pub/projects/speechd/%{name}-%{version}.tar.gz
-Source1: speech-dispatcherd
-
+Source1: speech-dispatcherd.service
BuildRequires: alsa-lib-devel
BuildRequires: dotconf-devel
BuildRequires: espeak-devel
@@ -24,6 +23,12 @@ Buildrequires: libao-devel
Buildrequires: pulseaudio-lib-devel
BuildRequires: python-setuptools-devel
BuildRequires: texinfo
+BuildRequires: systemd-units
+Requires(post): systemd-units
+Requires(post): systemd-sysv
+Requires(post): chkconfig
+Requires(preun): systemd-units
+Requires(postun): systemd-units
%ifnarch s390 s390x
BuildRequires: libraw1394
@@ -31,9 +36,6 @@ BuildRequires: libraw1394
Requires: festival-freebsoft-utils
-Requires(post): /sbin/chkconfig /sbin/install-info
-Requires(preun): /sbin/chkconfig /sbin/service /sbin/install-info
-Requires(postun): /sbin/service
%description
* Common interface to different TTS engines
@@ -106,8 +108,8 @@ for dir in \
popd
done
-mkdir -p %{buildroot}%{_initrddir}
-install -p -m 0755 %SOURCE1 %{buildroot}%{_initrddir}/
+mkdir -p %{buildroot}%{_unitdir}
+install -p -m 0644 %SOURCE1 %{buildroot}%{_unitdir}/
#Rename certain generically named binaries
mv %{buildroot}%{_bindir}/long_message %{buildroot}%{_bindir}/spd_long_message
@@ -137,21 +139,37 @@ rm -rf %{buildroot}
%post
/sbin/ldconfig
-/sbin/chkconfig --add speech-dispatcherd
+if [ $1 -eq 1 ] ; then
+ # Initial installation
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
%postun
/sbin/ldconfig
-if [ "$1" -ge "1" ] ; then
- /sbin/service speech-dispatcherd 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 speech-dispatcherd.service >/dev/null 2>&1 || :
fi
%preun
-if [ $1 = 0 ] ; then
- /sbin/service speech-dispatcherd stop >/dev/null 2>&1
- /sbin/chkconfig --del speech-dispatcherd
+if [ $1 -eq 0 ] ; then
+ # Package removal, not upgrade
+ /bin/systemctl --no-reload disable speech-dispatcherd.service > /dev/null 2>&1 || :
+ /bin/systemctl stop speech-dispatcherd.service > /dev/null 2>&1 || :
fi
+%triggerun -- speech-dispatcherd < 0.7.1-6
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply httpd
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save speech-dispatcherd >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del speech-dispatcherd >/dev/null 2>&1 || :
+/bin/systemctl try-restart speech-dispatcherd.service >/dev/null 2>&1 || :
+
%files
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog NEWS README COPYING
@@ -173,7 +191,7 @@ fi
%dir %attr(0700, root, root) %{_localstatedir}/log/speech-dispatcher/
-%attr(0755,root,root)%{_initrddir}/speech-dispatcherd
+%{_unitdir}/speech-dispatcherd.service
%files devel
%defattr(-,root,root,-)
@@ -203,6 +221,9 @@ fi
%{python_sitearch}/speechd*
%changelog
+* Thu Jul 26 2011 Jóhann B. Guðmundsson <johannbg at gmail.com> - 0.7.1-6
+- Introduce systemd unit file, drop SysV support
+
* Tue Mar 15 2011 Rex Dieter <rdieter at fedoraproject.org> 0.7.1-5
- safer rpath handling (#654585)
More information about the scm-commits
mailing list