[sysstat/f16] 10.0.2, convert to systemd

Tom Callaway spot at fedoraproject.org
Mon Sep 12 18:35:09 UTC 2011


commit e0813ec472a0fe036d29b537cdf15843a9207955
Author: Tom "spot" Callaway <tcallawa at redhat.com>
Date:   Mon Sep 12 14:34:57 2011 -0400

    10.0.2, convert to systemd

 sources         |    2 +-
 sysstat.service |   12 +++++++++++
 sysstat.spec    |   56 ++++++++++++++++++++++++++++++++++++++----------------
 3 files changed, 52 insertions(+), 18 deletions(-)
---
diff --git a/sources b/sources
index 0da7054..1ee30a5 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-b6744a28717dad6a5909fbb2e68b1dc6  sysstat-10.0.1.tar.bz2
+0dc5c4baf4165658450dd60913aa75bc  sysstat-10.0.2.tar.bz2
diff --git a/sysstat.service b/sysstat.service
new file mode 100644
index 0000000..4d96261
--- /dev/null
+++ b/sysstat.service
@@ -0,0 +1,12 @@
+[Unit]
+Description= Resets System Activity Logs
+After=syslog.target 
+
+[Service]
+Type=oneshot
+ExecStart=/usr/lib64/sa/sa1 --boot
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/sysstat.spec b/sysstat.spec
index d178d22..0caabb4 100644
--- a/sysstat.spec
+++ b/sysstat.spec
@@ -1,22 +1,24 @@
 Name: sysstat
-Version: 10.0.1
+Version: 10.0.2
 Release: 1%{?dist}
 Summary: The sar and iostat system monitoring commands
 License: GPLv2+
 Group: Applications/System
 URL:    http://perso.orange.fr/sebastien.godard/
-Source: http://perso.orange.fr/sebastien.godard/%{name}-%{version}.tar.bz2
+Source0: http://perso.orange.fr/sebastien.godard/%{name}-%{version}.tar.bz2
+Source1: sysstat.service
 # fixes #643380
 Patch11: sysstat-10.0.0-cpu.patch
 Patch12: sysstat-10.0.0-makefile.patch
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 
-
-Requires: /sbin/chkconfig
 Requires: sh-utils textutils grep fileutils /etc/cron.d
 BuildRequires: lm_sensors-devel
 BuildRequires: perl %{_includedir}/linux/if.h gettext
 BuildRequires: autoconf automake
-Requires: %__cp %__mv %__chmod %__grep %__mkdir %__install %__id
+BuildRequires: systemd-units
+Requires(post): systemd-sysv
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
 
 %description
 This package provides the sar and iostat commands for Linux. Sar and
@@ -36,37 +38,53 @@ CFLAGS="$RPM_OPT_FLAGS -DSADC_PATH=\\\"%{_libdir}/sa/sadc\\\""
 make CFLAGS="$CFLAGS" LFLAGS=""
 
 %install
-rm -rf %{buildroot}
 make install
 
 mkdir -p %{buildroot}/%{_sysconfdir}/cron.d
 install -m 0644 cron/sysstat.crond %{buildroot}/%{_sysconfdir}/cron.d/sysstat
-mkdir -p %{buildroot}%{_initrddir}
-install -m 0755 sysstat %{buildroot}%{_initrddir}/
+mkdir -p %{buildroot}%{_unitdir}
+install -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/
 
 %find_lang %{name}
 
 %post
-/sbin/chkconfig --add sysstat
+if [ $1 -eq 1 ] ; then 
+    # Initial installation 
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
 
 %preun
-if [ "$1" = 0 ]; then
+if [ $1 -eq 0 ]; then
+  /bin/systemctl --no-reload disable sysstat.service > /dev/null 2>&1 || :
+  /bin/systemctl stop sysstat.service > /dev/null 2>&1 || :
   # Remove sa logs if removing sysstat completely
   rm -f %{_localstatedir}/log/sa/*
-  # Remove service
-  /sbin/chkconfig --del sysstat
 fi
 
-%clean
-rm -rf %{buildroot}
+%postun
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+    # Package upgrade, not uninstall
+    /bin/systemctl try-restart sysstat.service >/dev/null 2>&1 || :
+fi
+
+%triggerun -- sysstat < 10.0.2-1
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply sysstat
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save sysstat >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del sysstat >/dev/null 2>&1 || :
+/bin/systemctl try-restart sysstat.service >/dev/null 2>&1 || :
+
 
 %files -f %{name}.lang
-%defattr(-,root,root,-)
 %doc CHANGES COPYING CREDITS README TODO FAQ
 %config(noreplace) %{_sysconfdir}/cron.d/sysstat
 %config(noreplace) %{_sysconfdir}/sysconfig/sysstat
 %config(noreplace) %{_sysconfdir}/sysconfig/sysstat.ioconf
-%{_initrddir}/sysstat
+%{_unitdir}/sysstat.service
 %{_bindir}/*
 %{_libdir}/sa
 %{_mandir}/man1/*
@@ -75,6 +93,10 @@ rm -rf %{buildroot}
 %{_localstatedir}/log/sa
 
 %changelog
+* Mon Sep 12 2011 Tom Callaway <spot at fedoraproject.org> - 10.0.2-1
+- update to 10.0.2
+- convert to systemd
+
 * Tue Jun  7 2011 Ivana Hutarova Varekova <varekova at redhat.com> - 10.0.1-1
 - update to 10.0.1
 - remove useles patches


More information about the scm-commits mailing list