[haveged/f18] Introduce new systemd-rpm macros in haveged spec file
Jirka Hladky
jhladky at fedoraproject.org
Sat Oct 13 13:48:21 UTC 2012
commit 37786e83f57af5bcc8331e5cc4ea364286efef14
Author: Jirka Hladky <hladky.jiri at gmail.com>
Date: Sat Oct 13 15:48:17 2012 +0200
Introduce new systemd-rpm macros in haveged spec file
haveged.spec | 62 +++++++++++++++-------------------------------------------
1 files changed, 16 insertions(+), 46 deletions(-)
---
diff --git a/haveged.spec b/haveged.spec
index dbdfb84..6a5e44f 100644
--- a/haveged.spec
+++ b/haveged.spec
@@ -1,16 +1,16 @@
Summary: A Linux entropy source using the HAVEGE algorithm
Name: haveged
Version: 1.5
-Release: 1%{?dist}
+Release: 2%{?dist}
License: GPLv3+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Group: System Environment/Daemons
URL: http://www.irisa.fr/caps/projects/hipsor/
Source0: http://www.issihosts.com/haveged/%{name}-%{version}.tar.gz
Source1: haveged.service
-Requires(post): systemd-units
-Requires(preun): systemd-units
-Requires(postun): systemd-units
+Requires(post): systemd
+Requires(preun): systemd
+Requires(postun): systemd
# SystemV -> SystemD conversion
# This is actually needed for the %%triggerun script but Requires(triggerun)
@@ -20,7 +20,7 @@ Requires(post): systemd-sysv
# SystemV -> SystemD conversion
-BuildRequires: automake gdb coreutils systemd-units glibc-common
+BuildRequires: automake gdb coreutils glibc-common
%description
A Linux entropy source using the HAVEGE algorithm
@@ -90,51 +90,13 @@ popd
rm -rf %{buildroot}
%post
-if [ $1 -eq 1 ] ; then
- # Initial installation
- /bin/systemctl enable haveged.service >/dev/null 2>&1 || :
-fi
+%systemd_post haveged.service
%preun
-if [ $1 -eq 0 ] ; then
- # Package removal, not upgrade
- /bin/systemctl --no-reload disable haveged.service > /dev/null 2>&1 || :
- /bin/systemctl stop haveged.service > /dev/null 2>&1 || :
-fi
+%systemd_preun haveged.service
%postun
-/bin/systemctl daemon-reload >/dev/null 2>&1 || :
-if [ $1 -ge 1 ] ; then
- # Package upgrade, not uninstall
- /bin/systemctl try-restart haveged.service >/dev/null 2>&1 || :
-fi
-
-### A sysv => systemd migration contains all of the same scriptlets as a
-### systemd package. These are additional scriptlets
-
-# Note: the NEVR in trigger scripts should all be the version in
-# which the package switched to systemd unit files and the comparision
-# should be less than. Using <= the last version with the sysV script won't
-# work for several reasons:
-# 1) disttag is different between Fedora releases
-# 2) An update in an old Fedora release may create a newer NEVR
-# Note that this means an update in an older Fedora release must be NEVR
-# lower than this. Freezing the version and release of the old package and
-# using a number after the disttag is one way to do this. Example:
-# httpd-1.0-1%{?dist} => httpd-1.0-1%{?dist}.1
-
-%triggerun -- haveged < 1.4-1
-# 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 haveged >/dev/null 2>&1 ||:
-
-# If the package is allowed to autostart:
-/bin/systemctl --no-reload enable haveged.service >/dev/null 2>&1 ||:
-
-# Run these because the SysV package being removed won't do them
-/sbin/chkconfig --del haveged >/dev/null 2>&1 || :
-/bin/systemctl try-restart haveged.service >/dev/null 2>&1 || :
+%systemd_postun_with_restart haveged.service
%files
%defattr(-, root, root, -)
@@ -144,6 +106,14 @@ fi
%doc COPYING README ChangeLog AUTHORS
%changelog
+* Sat Oct 13 2012 Jirka Hladky <hladky.jiri at gmail.com> - 1.5-2
+- BZ 850144
+- Introduce new systemd-rpm macros in haveged spec file
+- Fedora 19 changes the way how to work with services in spec files.
+- It introduces new macros - %systemd_post, %systemd_preun and %systemd_postun;
+- which replace scriptlets from Fedora 18 and older
+- see https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd
+
* Tue Aug 14 2012 Jirka Hladky <hladky.jiri at gmail.com> - 1.5-1
- Update to the version 1.5
- Main new feature is a run time verification of the produced random numbers
More information about the scm-commits
mailing list