File sec.spec of Package sec
#
# spec file for package sec
#
# Copyright (c) 2012-2023 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2012-2023 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
%endif
Name: sec
Version: 2.9.3
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}/releases/download/%{version}/%{name}-%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: https://github.com/simple-evcorr/rulesets/archive/refs/tags/20211119.tar.gz#/rulesets-20211119.tar.gz
BuildRequires: systemd-rpm-macros
BuildRequires: pkgconfig(systemd)
Requires(pre): %fillup_prereq
Requires(post): systemd
Requires: perl = %{perl_version}
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
%setup -q -T -D -a 1
set -- 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}
install -Dm 0644 contrib/suse.service %{buildroot}%{_unitdir}/%{name}.service
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/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
%pre
%service_add_pre sec.service
%post
%service_add_post sec.service
%{fillup_only sec}
%preun
%service_del_preun sec.service
%postun
%service_del_postun sec.service
%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}
%{_fillupdir}/sysconfig.sec
%{_unitdir}/%{name}.service
%changelog