From 72d6eb491df363cba532c6210a00732f1811dd3d Mon Sep 17 00:00:00 2001 From: "Tom \"spot\" Callaway" Date: Mon, 12 Sep 2011 14:34:29 -0400 Subject: [PATCH] 10.0.2, convert to systemd --- .gitignore | 2 ++ sources | 2 +- sysstat.service | 12 ++++++++++ sysstat.spec | 64 +++++++++++++++++++++++++++++++++---------------- 4 files changed, 58 insertions(+), 22 deletions(-) create mode 100644 sysstat.service diff --git a/.gitignore b/.gitignore index b909dac..7de90fb 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ /sysstat-10.0.1.tar.bz2 +/sysstat-10.0.2.tar.gz +/sysstat-10.0.2.tar.bz2 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 - -%preun -if [ "$1" = 0 ]; then - # Remove sa logs if removing sysstat completely - rm -f %{_localstatedir}/log/sa/* - # Remove service - /sbin/chkconfig --del sysstat +if [ $1 -eq 1 ] ; then + # Initial installation + /bin/systemctl daemon-reload >/dev/null 2>&1 || : fi -%clean -rm -rf %{buildroot} +%preun +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/* +fi + +%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 - 10.0.2-1 +- update to 10.0.2 +- convert to systemd + * Tue Jun 7 2011 Ivana Hutarova Varekova - 10.0.1-1 - update to 10.0.1 - remove useles patches