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-2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2012-2015 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.7.7
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} > 1230
BuildRequires:  systemd
%{?systemd_requires}
%endif
%if 0%{?suse_version} > 1230
Requires(pre):  %fillup_prereq
%else
Requires(pre):  %insserv_prereq %fillup_prereq
%endif
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
install -Dm 0755 sec %{buildroot}%{_bindir}/%{name}
install -Dm 0644 sec.man %{buildroot}%{_mandir}/man1/%{name}.1
mkdir -p %{buildroot}%{_sbindir}
%if 0%{?suse_version} > 1230
install -Dm 0644 contrib/suse.service %{buildroot}%{_unitdir}/%{name}.service
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcsec
%else
install -Dm 0755 contrib/suse.startup %{buildroot}%{_initrddir}/%{name}
pushd %{buildroot}%{_sbindir}
ln -s %{_initrddir}/sec rcsec
popd
%endif
install -Dm 0644 contrib/suse.sysconfig %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.sec
# Remove executable bits because these files get packed as docs
chmod 0644 contrib/convert.pl contrib/swatch2sec.pl

%if 0%{?suse_version} > 1230
%pre
%service_add_pre sec.service
%endif

%post
%if 0%{?suse_version} > 1230
%service_add_post sec.service
%{fillup_only sec}
%else
%{fillup_and_insserv sec}
%endif

%preun
%if 0%{?suse_version} > 1230
%service_del_preun sec.service
%else
%stop_on_removal sec
%endif

%postun
%if 0%{?suse_version} > 1230
%service_del_postun sec.service
%else
%insserv_cleanup
%restart_on_update sec
%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}
%{_localstatedir}/adm/fillup-templates/sysconfig.sec
%if 0%{?suse_version} > 1230
%{_unitdir}/%{name}.service
%else
%config %{_initrddir}/%{name}
%endif

%changelog