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-2017 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2012-2017 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/

#Compat macro for new _fillupdir macro introduced in Nov 2017
%if ! %{defined _fillupdir}
  %define _fillupdir /var/adm/fillup-templates

Name:           sec
Version:        2.7.12
Release:        0
License:        GPL-2.0
Summary:        Simple Event Correlator script to filter log file entries
URL:            http://simple-evcorr.github.io/
Group:          System/Daemons
Source0:        https://github.com/simple-evcorr/%{name}/archive/%{name}.tar.gz#/%{name}-%{version}.tar.gz
# Get example rulesets from git repo
Source1:        get_rulesets_from_git.sh
Source2:        sec-rulesets-20171028.tar.gz
%if 0%{?suse_version} > 1230
BuildRequires:  systemd
%if 0%{?suse_version} > 1230
Requires(pre):  %fillup_prereq
Requires(pre):  %insserv_prereq %fillup_prereq
Requires:       perl = %{perl_version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

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.

%setup -q
# Add example rulesets
%setup -q -T -D -a 2
set -- sec-rulesets-*/*
mkdir examples
mv "$@" examples/

# No building required, just a placehoder

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
install -Dm 0755 contrib/suse.startup %{buildroot}%{_initrddir}/%{name}
pushd %{buildroot}%{_sbindir}
ln -s %{_initrddir}/sec rcsec
install -Dm 0644 contrib/suse.sysconfig %{buildroot}%{_fillupdir}/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
%service_add_pre sec.service

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

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

%if 0%{?suse_version} > 1230
%service_del_postun sec.service
%restart_on_update sec

%doc ChangeLog COPYING README contrib/convert.pl contrib/itostream.c contrib/swatch2sec.pl examples
%if 0%{?suse_version} > 1230
%config %{_initrddir}/%{name}