[sec] Upgrade to systemd

Stefan Schulze Frielinghaus stefansf at fedoraproject.org
Sat Jun 11 20:42:58 UTC 2011


commit 332f982cd7bb6ff49b6d12d2cd7a7c7d445f1e14
Author: Stefan Schulze Frielinghaus <stefansf at fedoraproject.org>
Date:   Sat Jun 11 22:42:31 2011 +0200

    Upgrade to systemd

 sec.service |   11 +++++++++++
 sec.spec    |   33 +++++++++++++++++----------------
 2 files changed, 28 insertions(+), 16 deletions(-)
---
diff --git a/sec.service b/sec.service
new file mode 100644
index 0000000..a8e3136
--- /dev/null
+++ b/sec.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Simple Event Correlator script to filter log file entries
+After=syslog.target
+
+[Service]
+Type=forking
+PIDFile=/run/sec.pid
+ExecStart=/usr/bin/sec -detach -pid=/run/sec.pid -conf=/etc/sec/*.sec -input=/var/log/messages -log=/var/log/sec -intevents
+
+[Install]
+WantedBy=multi-user.target
diff --git a/sec.spec b/sec.spec
index 1c59813..ad11542 100644
--- a/sec.spec
+++ b/sec.spec
@@ -1,13 +1,12 @@
 Name:           sec
 Version:        2.6.0
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Simple Event Correlator script to filter log file entries
 Group:          System Environment/Daemons
 License:        GPLv2+
 URL:            http://simple-evcorr.sourceforge.net/
 Source0:        http://downloads.sourceforge.net/simple-evcorr/%{name}-%{version}.tar.gz
-Source1:        sec.sysconfig
-Source2:        sec.init
+Source1:        sec.service
 Source3:        sec.logrotate
 # Example files and configuration info
 Source4:        conf.README
@@ -34,13 +33,13 @@ Source24:       http://simple-evcorr.sourceforge.net/rulesets/vtund.sec
 Source25:       http://simple-evcorr.sourceforge.net/rulesets/windows.sec
 BuildArch:      noarch
 
-# The init script uses arrays, so we need bash
-Requires:       bash
 Requires:       logrotate
 
-Requires(post):     chkconfig
-Requires(postun):   initscripts
-Requires(preun):    initscripts, chkconfig
+Requires(post):   systemd-units
+Requires(preun):  systemd-units
+Requires(postun): systemd-units
+
+BuildRequires: systemd-units
 
 %description
 SEC is a simple event correlation tool that reads lines from files, named
@@ -59,9 +58,8 @@ writing messages to pipes or files, etc.
 # Install SEC and its associated files
 install -D -m 0755 -p sec        %{buildroot}%{_bindir}/sec
 install -D -m 0644 -p sec.man    %{buildroot}%{_mandir}/man1/sec.1
-install -D -m 0644 -p %{SOURCE1} %{buildroot}%{_sysconfdir}/sysconfig/sec
+install -D -m 0644 -p %{SOURCE1} %{buildroot}%{_unitdir}/sec.service
 install -D -m 0644 -p %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/sec
-install -D -m 0755 -p %{SOURCE2} %{buildroot}%{_initrddir}/sec
 
 # Install the example config files and readme
 install -D -m 0644 -p %{SOURCE4} %{buildroot}%{_sysconfdir}/%{name}/README
@@ -78,18 +76,19 @@ chmod 0644 contrib/convert.pl contrib/swatch2sec.pl
 
 %post
 if [ $1 -eq 1 ]; then
-        /sbin/chkconfig --add sec
+        /bin/systemctl daemon-reload >/dev/null 2>&1 || :
 fi
 
 %preun
 if [ $1 -eq 0 ]; then
-        /sbin/service sec stop >/dev/null 2>&1
-        /sbin/chkconfig --del sec
+        /bin/systemctl --no-reload disable sec.service > /dev/null 2>&1 || :
+        /bin/systemctl stop sec.service > /dev/null 2>&1 || :
 fi
 
 %postun
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
 if [ $1 -eq 1 ]; then
-        /sbin/service sec condrestart >/dev/null 2>&1
+        /bin/systemctl try-restart sec.service >/dev/null 2>&1 || :
 fi
 
 %clean
@@ -99,13 +98,15 @@ rm -rf %{buildroot}
 %defattr(-,root,root,-)
 %doc ChangeLog COPYING README contrib/convert.pl contrib/itostream.c contrib/swatch2sec.pl examples
 %config(noreplace) %{_sysconfdir}/%{name}
-%config(noreplace) %{_sysconfdir}/sysconfig/sec
 %config(noreplace) %{_sysconfdir}/logrotate.d/sec
-%{_initrddir}/sec
 %{_bindir}/sec
 %{_mandir}/man1/sec.1*
+%{_unitdir}/sec.service
 
 %changelog
+* Sat Jun 11 2011 Stefan Schulze Frielinghaus <stefansf at fedoraproject.org> - 2.6.0-2
+- Upgrade to systemd
+
 * Sun Mar 20 2011 Stefan Schulze Frielinghaus <stefansf at fedoraproject.org> - 2.6.0-1
 - New upstream release
 


More information about the scm-commits mailing list