LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File sec.spec of Package sec (Project server:monitoring)

#
# spec file for package sec
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2012 Malcolm J Lewis <malcolmlewis@opensuse.org>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

Name:           sec
Version:        2.6.2
Release:        0
License:        GPL-2.0
Summary:        Simple Event Correlator script to filter log file entries
Url:            http://simple-evcorr.sourceforge.net/
Group:          System/Daemons
Source0:        http://downloads.sourceforge.net/simple-evcorr/%{name}-%{version}.tar.gz
# Example rulesets
# wget -r -l1 --no-parent -A sec http://simple-evcorr.sourceforge.net/rulesets/
# tar -cjf simple-evcorr.sourceforge.net.tar.bz2 simple-evcorr.sourceforge.net
Source1:        simple-evcorr.sourceforge.net.tar.bz2
%if 0%{?suse_version} > 1140
BuildRequires:  systemd
%endif
%if 0%{?suse_version} > 1140
%{?systemd_requires}
%endif
Requires(pre):  %insserv_prereq %fillup_prereq
Requires:       perl = %{perl_version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
SEC is a simple event correlation tool that reads lines from files, named
pipes, or standard input, and matches the lines with regular expressions,
Perl subroutines, and other patterns for recognizing input events.
Events are then correlated according to the rules in configuration files,
producing output events by executing user-specified shell commands, by
writing messages to pipes or files, etc.

%prep
%setup -q
# Add example rulesets
tar -xvvjf %{SOURCE1}
set -- simple-evcorr.sourceforge.net/rulesets/*
mkdir examples
mv "$@" examples/

%build
# No building required, just a placehoder

%install
mkdir -p %{buildroot}%{_bindir}
install -m 0755 sec %{buildroot}%{_bindir}/%{name}
mkdir -p %{buildroot}%{_mandir}/man1
install -m 0644 sec.man %{buildroot}%{_mandir}/man1/%{name}.1
mkdir -p %{buildroot}%{_initrddir}
install -m 0755 contrib/suse.startup %{buildroot}%{_initrddir}/%{name}
%if 0%{?suse_version} > 1140
mkdir -p %{buildroot}%{_unitdir}
install -m 0644 contrib/suse.service %{buildroot}%{_unitdir}/%{name}.service
%endif
mkdir -p %{buildroot}%{_localstatedir}/adm/fillup-templates
install -m 0644 contrib/suse.sysconfig %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.sec
mkdir -p %{buildroot}%{_sbindir}
ln -sf %{_initrddir}/sec %{buildroot}%{_sbindir}/rcsec
# Remove executable bits because these files get packed as docs
chmod 0644 contrib/convert.pl contrib/swatch2sec.pl

%if %suse_version > 1140

%pre
%service_add_pre sec.service
%endif

%post
%{fillup_and_insserv sec}
%if %suse_version > 1140
%service_add_post sec.service
%endif

%preun
%stop_on_removal sec
%if %suse_version > 1140
%service_del_preun sec.service
%endif

%postun
%restart_on_update sec
%insserv_cleanup
%if %suse_version > 1140
%service_del_postun sec.service
%endif

%files
%defattr(-,root,root,-)
%doc ChangeLog COPYING README contrib/convert.pl contrib/itostream.c contrib/swatch2sec.pl examples
%{_bindir}/%{name}
%{_sbindir}/rcsec
%{_mandir}/man1/sec.1%{?ext_man}
%config %{_initrddir}/%{name}
%{_localstatedir}/adm/fillup-templates/sysconfig.sec
%if 0%{?suse_version} > 1140
%{_unitdir}/%{name}.service
%endif

%changelog