File falco-event-generator.spec of Package falco-event-generator
#
# spec file for package falco-event-generator
#
# Copyright (c) 2024 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#
%define __arch_install_post export NO_BRP_STRIP_DEBUG=true
%define executable_name event-generator
Name: falco-event-generator
Version: 0.12.0
Release: 0
Summary: A simple daemon for connecting Falco to your ecosystem
License: Apache-2.0
URL: https://github.com/falcosecurity/event-generator
Source0: %{name}-%{version}.tar.gz
Source1: vendor.tar.gz
Source2: events_k8saudit.tar.gz
BuildRequires: go >= 1.23
%description
Generate a variety of suspect actions that are detected by Falco rulesets.
Warning — We strongly recommend that you run the program within Docker (see
below), since some commands might alter your system. For example, some actions
modify files and directories below /bin, /etc, /dev, etc. Make sure you fully
understand what is the purpose of this tool before running any action.
Notice — From version v0.11.0 the event-generator requires Falco 0.37.0 or
newer. Previous versions of the event-generator might be compatible with older
versions of Falco, however, we do not guarantee it.
%package -n %{name}-bash-completion
Summary: Bash Completion for %{name}
Group: System/Shells
Requires: %{name} = %{version}
Requires: bash-completion
Supplements: (%{name} and bash-completion)
BuildArch: noarch
%description -n %{name}-bash-completion
Bash command line completion support for %{name}.
%package -n %{name}-fish-completion
Summary: Fish Completion for %{name}
Group: System/Shells
Requires: %{name} = %{version}
Supplements: (%{name} and fish)
BuildArch: noarch
%description -n %{name}-fish-completion
Fish command line completion support for %{name}.
%package -n %{name}-zsh-completion
Summary: Zsh Completion for %{name}
Group: System/Shells
Requires: %{name} = %{version}
Supplements: (%{name} and zsh)
BuildArch: noarch
%description -n %{name}-zsh-completion
zsh command line completion support for %{name}.
%prep
%autosetup -p 1 -a 1
tar vxf %{SOURCE2}
%build
export CLIENTGO_VERSION="$(grep 'k8s.io/client-go' go.mod | cut -dv -f2)"
go build \
-mod=vendor \
-buildmode=pie \
-ldflags=" \
-X k8s.io/client-go/pkg/version.gitCommit=v${CLIENTGO_VERSION} \
-X k8s.io/client-go/pkg/version.gitVersion=%{version}" \
-o bin/%{executable_name} .
%install
# Install the binary.
install -D -m 0755 bin/%{executable_name} %{buildroot}/%{_bindir}/%{executable_name}
# create the bash completion file
mkdir -p %{buildroot}%{_datarootdir}/bash-completion/completions/
%{buildroot}/%{_bindir}/%{executable_name} completion bash > %{buildroot}%{_datarootdir}/bash-completion/completions/%{executable_name}
# create the fish completion file
mkdir -p %{buildroot}%{_datarootdir}/fish/vendor_completions.d/
%{buildroot}/%{_bindir}/%{executable_name} completion fish > %{buildroot}%{_datarootdir}/fish/vendor_completions.d/%{executable_name}.fish
# create the zsh completion file
mkdir -p %{buildroot}%{_datarootdir}/zsh_completion.d/
%{buildroot}/%{_bindir}/%{executable_name} completion zsh > %{buildroot}%{_datarootdir}/zsh_completion.d/_%{executable_name}
%files
%doc README.md
%license LICENSE
%{_bindir}/%{executable_name}
%files -n %{name}-bash-completion
%dir %{_datarootdir}/bash-completion/completions/
%{_datarootdir}/bash-completion/completions/%{executable_name}
%files -n %{name}-fish-completion
%dir %{_datarootdir}/fish
%dir %{_datarootdir}/fish/vendor_completions.d
%{_datarootdir}/fish/vendor_completions.d/%{executable_name}.fish
%files -n %{name}-zsh-completion
%defattr(-,root,root)
%dir %{_datarootdir}/zsh_completion.d/
%{_datarootdir}/zsh_completion.d/_%{executable_name}
%changelog