[haveged] Update to 1.4 SPEC File

Jirka Hladky jhladky at fedoraproject.org
Tue Feb 14 22:29:02 UTC 2012


commit eaceec3926f07d4e04a99ae7c6c0a5e269abf40e
Author: Jirka Hladky <hladky.jiri at gmail.com>
Date:   Tue Feb 14 23:28:59 2012 +0100

    Update to 1.4 SPEC File

 haveged.spec |  100 +++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 65 insertions(+), 35 deletions(-)
---
diff --git a/haveged.spec b/haveged.spec
index 32ad5c3..0b5ed61 100644
--- a/haveged.spec
+++ b/haveged.spec
@@ -1,23 +1,25 @@
 Summary:        A Linux entropy source using the HAVEGE algorithm
 Name:           haveged
-Version:        1.3
-Release:        4%{?dist}
+Version:        1.4
+Release:        1%{?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/haveged-1.3.tar.gz
-#Source1:       test.gdb
-Patch0:         haveged-1.3_ppc.patch
-Patch1:         haveged-1.3_s390.patch
-#Source2:       cpuid-20110305.src.tar.gz
-# Patch represents changes planed for the version 1.3:
-# - changed run levels:
-# - added option to write random bytes to stdout: -f -
-#Patch0:         haveged-1.2_jh.patch 
-Requires(post):   chkconfig
-Requires(preun):  chkconfig, initscripts
-Requires(postun): initscripts
+Source0:        http://www.issihosts.com/haveged/haveged-1.4.tar.gz
+Source1:        haveged.service
+Requires(post):   systemd-units
+Requires(preun):  systemd-units
+Requires(postun): systemd-units
+
+# SystemV -> SystemD conversion
+# This is actually needed for the %%triggerun script but Requires(triggerun)
+# is not valid.  We can use %%post because this particular %%triggerun script
+# should fire just after this package is installed.
+Requires(post): systemd-sysv
+# SystemV -> SystemD conversion
+
+
 BuildRequires:  automake gdb coreutils
 
 %description
@@ -39,8 +41,6 @@ attempt to select appropriate values from internal tables.
 
 %prep
 %setup -q
-%patch0 -p1 -b .ppc
-%patch1 -p1 -b .s390
 
 %build
 autoreconf -fiv
@@ -70,46 +70,76 @@ make check
 rm -rf %{buildroot}
 make install DESTDIR=%{buildroot} INSTALL="%{__install} -p"
 
-#Installing Fedora specific haveged SysV-style initscript 
-#http://fedoraproject.org/wiki/Packaging:SysVInitScript
-#Need to remove haveged specific script from __buildroot__ since it's installed to the wrong location 
-#(/etc/init.d instead of /etc/rc.d/init.d)
-rm -rf %{buildroot}/etc/init.d
-install -m755 -D contrib/haveged_fedora %{buildroot}%{_initrddir}/haveged
 chmod 0644 COPYING README ChangeLog AUTHORS
 
+#Install systemd service file
+rm -rf %{buildroot}/etc/init.d
+pushd $RPM_BUILD_ROOT
+mkdir -p .%{_unitdir}
+install -p -m644 %{SOURCE1} .%{_unitdir}/haveged.service
+popd
+
 %clean
 rm -rf %{buildroot}
 
 %post
-/sbin/chkconfig --add haveged
+if [ $1 -eq 1 ] ; then 
+    # Initial installation
+    /bin/systemctl enable haveged.service >/dev/null 2>&1 || :
+fi
 
 %preun
-if [ "$1" -eq "0" ]; then
-  /sbin/service haveged stop >/dev/null 2>&1
-  /sbin/chkconfig --del haveged
+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
 
 %postun
-if [ "$1" -ge "1" ]; then
-  /sbin/service haveged 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 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 || :
 
 %files
 %defattr(-, root, root, -)
 %{_mandir}/man8/haveged.8*
 %{_sbindir}/haveged
-%{_initrddir}/haveged
+%{_unitdir}/haveged.service
 %doc COPYING README ChangeLog AUTHORS
 
 %changelog
-* Fri Jan 13 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.3-4
-- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
-
-* Fri Nov 25 2011 Dan HorĂ¡k <dan[at]danny.cz> - 1.3-3
-- fix compile on s390(x)
-
+* Tue Feb 14 2012 Jirka Hladky <hladky.jiri at gmail.com> - 1.4-1
+- Update to the version 1.4
+- Conversion to systemd, drop init script
 * Sat Nov 06 2011 Jirka Hladky <hladky.jiri at gmail.com> - 1.3-2
 - Fixed a bug on non x86 systems
 * Sat Nov 05 2011 Jirka Hladky <hladky.jiri at gmail.com> - 1.3-1


More information about the scm-commits mailing list