add auditbeat7 ebuild (#123)

Co-authored-by: i.panteleev <i.panteleev@rbk.money>
This commit is contained in:
Ivan Panteleev 2021-11-12 11:52:34 +03:00 committed by GitHub
parent 4ee2cb2837
commit 0b2001590d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 92 additions and 0 deletions

View File

@ -1 +1,2 @@
DIST auditbeat-6.8.11.tar.gz 35567290 SHA256 0e4e7f4d8e171e3f1ddb2ea0042e20a829f79e7ee295b863001bccf8d9e607ce SHA512 abd0bc9e267a8ebac3d73b9eba34e0ef838e304936670acbfbe56ed64e452df5b1e60992e63d090f353afca8b6c5fcfed9c9f24a5ce02c02c8f2ac125b983182 WHIRLPOOL ffd0b916471bc0d45504d24c704c6b961a06239ab386a35ecd36dab26ab0d19eeae7eeb19e0433a23c140b2f7d540b9c248f27b913b3e2fd8282423179b0875b
DIST auditbeat-7.10.2.tar.gz 87244727 SHA256 eb10fcb454fe62695d437ca8f40e6f6233fb7167ba88dde7b373eaca1044b045 SHA512 eba0cda8521068f4d15dfb39808695a8de47a568e4d11949746a8f698aaff6825848d5e524bd16b0e555786e277512014dfe33d4daee8c3acef9a9867653c1c3 WHIRLPOOL 77428e2436ef218f1f2838768b3f0da3eafa4d50fd60c28ea79f6948ab8c2c8680fb442212cd4073b01e15c5db0cc99fd15a8a0a8bddd8c7de1fdad108806543

View File

@ -0,0 +1,91 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit systemd
DESCRIPTION="Lightweight shipper for audit data"
HOMEPAGE="https://www.elastic.co/products/beats"
SRC_URI="https://github.com/elastic/beats/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="Apache-2.0 BSD-2 MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
RESTRICT="test"
IUSE="cpu_flags_x86_avx cpu_flags_x86_avx2 selinux"
DEPEND=">=dev-lang/go-1.12.9"
RDEPEND="!sys-process/auditbeat-bin
selinux? ( sec-policy/selinux-auditbeat )"
# Do not complain about CFLAGS etc since go projects do not use them.
QA_FLAGS_IGNORED='.*'
S="${WORKDIR}/src/github.com/elastic/beats"
src_unpack() {
mkdir -p "${S%/*}" || die
default
mv beats-${PV} "${S}" || die
}
src_prepare() {
default
# avoid Elastic license
rm -r x-pack || die
# use ${PV} instead of git commit id
sed -i "s/\(COMMIT_ID=\).*/\1${PV}/g" "${S}/libbeat/scripts/Makefile" || die
# Disable autodetection AVX/AVX2
if ! use cpu_flags_x86_avx ; then
sed -i '/useAVX /Id' vendor/golang.org/x/crypto/blake2b/blake2b.go
sed -i '/AVX(/Id' vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.go
sed -i '/useAVX /Id' vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.go
fi
if ! use cpu_flags_x86_avx2 ; then
sed -i '/useAVX2 /Id' vendor/golang.org/x/crypto/blake2b/blake2b.go
sed -i '/AVX2(/Id' vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.go
sed -i '/useAVX2 /Id' vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.go
if ! use cpu_flags_x86_avx ; then
sed -i 's/} else if useSSE4/if useSSE4/g' vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.go
else
sed -i 's/} else if useAVX /if useAVX /g' vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.go
fi
fi
}
src_compile() {
GOPATH="${WORKDIR}" emake -C "${S}/auditbeat"
}
src_install() {
keepdir /etc/${PN}
keepdir /var/{lib,log}/${PN}
fperms 0750 /var/{lib,log}/${PN}
newconfd "${FILESDIR}/${PN}.confd" ${PN}
newinitd "${FILESDIR}/${PN}.initd.1" ${PN}
systemd_dounit "${FILESDIR}"/${PN}.service
docinto examples
dodoc ${PN}/{auditbeat.yml,auditbeat.reference.yml}
dobin auditbeat/auditbeat
}
pkg_postinst() {
if [[ -n "${REPLACING_VERSIONS}" ]]; then
elog "Please read the migration guide at:"
elog "https://www.elastic.co/guide/en/beats/libbeat/$(ver_cut 1-2)/upgrading.html"
elog ""
fi
elog "Example configurations:"
elog "${EROOT}/usr/share/doc/${PF}/examples"
}