From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1304446-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id D1DAF139345
	for <garchives@archives.gentoo.org>; Tue, 20 Jul 2021 19:36:54 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 19195E097D;
	Tue, 20 Jul 2021 19:36:54 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id E2357E0976
	for <gentoo-commits@lists.gentoo.org>; Tue, 20 Jul 2021 19:36:53 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 02CA733BF08
	for <gentoo-commits@lists.gentoo.org>; Tue, 20 Jul 2021 19:36:49 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 741F473A
	for <gentoo-commits@lists.gentoo.org>; Tue, 20 Jul 2021 19:36:47 +0000 (UTC)
From: "Conrad Kostecki" <conikost@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Conrad Kostecki" <conikost@gentoo.org>
Message-ID: <1626809543.8f401e86ce4d9c6dff59d180ec7363d0bdaa0884.conikost@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: app-admin/sagan/
X-VCS-Repository: repo/gentoo
X-VCS-Files: app-admin/sagan/sagan-2.0.1-r5.ebuild
X-VCS-Directories: app-admin/sagan/
X-VCS-Committer: conikost
X-VCS-Committer-Name: Conrad Kostecki
X-VCS-Revision: 8f401e86ce4d9c6dff59d180ec7363d0bdaa0884
X-VCS-Branch: master
Date: Tue, 20 Jul 2021 19:36:47 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: cd6d16b7-53fa-4fd0-8493-eae52f10d1b7
X-Archives-Hash: a8bb0661e066c4e4e5f509166efb2789

commit:     8f401e86ce4d9c6dff59d180ec7363d0bdaa0884
Author:     Conrad Kostecki <conikost <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 20 19:32:23 2021 +0000
Commit:     Conrad Kostecki <conikost <AT> gentoo <DOT> org>
CommitDate: Tue Jul 20 19:32:23 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8f401e86

app-admin/sagan: make lognorm non-optional

Disabling 'lognorm' causes a compilation failure, so making it, for now,
non-optional. As it was by default enabled, it should not harm.

Closes: https://bugs.gentoo.org/780045
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Conrad Kostecki <conikost <AT> gentoo.org>

 app-admin/sagan/sagan-2.0.1-r5.ebuild | 132 ++++++++++++++++++++++++++++++++++
 1 file changed, 132 insertions(+)

diff --git a/app-admin/sagan/sagan-2.0.1-r5.ebuild b/app-admin/sagan/sagan-2.0.1-r5.ebuild
new file mode 100644
index 00000000000..90d17144679
--- /dev/null
+++ b/app-admin/sagan/sagan-2.0.1-r5.ebuild
@@ -0,0 +1,132 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools flag-o-matic tmpfiles systemd
+
+DESCRIPTION="Sagan is a multi-threaded, real time system and event log monitoring system"
+HOMEPAGE="https://sagan.quadrantsec.com/"
+SRC_URI="https://sagan.quadrantsec.com/download/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="geoip +libdnet mysql redis +pcap smtp"
+
+BDEPEND="virtual/pkgconfig"
+DEPEND="
+	acct-group/sagan
+	acct-user/sagan
+	app-admin/sagan-rules
+	dev-libs/libestr
+	dev-libs/libfastjson:=
+	dev-libs/liblognorm
+	dev-libs/libpcre
+	dev-libs/libyaml
+	geoip? ( dev-libs/geoip )
+	redis? ( dev-libs/hiredis )
+	pcap? ( net-libs/libpcap )
+	smtp? ( net-libs/libesmtp )
+"
+
+# Package no longer logs directly to a database
+# and relies on Unified2 format to accomplish it
+RDEPEND="
+	${DEPEND}
+	mysql? ( net-analyzer/barnyard2[mysql] )
+"
+
+REQUIRED_USE="mysql? ( libdnet )"
+
+DOCS=( AUTHORS ChangeLog FAQ INSTALL README NEWS TODO )
+
+src_prepare() {
+	default
+
+	eautoreconf
+}
+
+src_configure() {
+	append-flags -fcommon
+
+	# TODO: poke at strstr logic and enable/disable CPU_FLAGS_X86_*
+	# accordingly?
+	# Note that not all of these are used:
+	# https://github.com/quadrantsec/sagan/blob/main/m4/ax_ext.m4
+	local myeconfargs=(
+		--enable-lognorm
+		$(use_enable smtp esmtp)
+		$(use_enable redis)
+		$(use_enable pcap libpcap)
+		$(use_enable geoip)
+	)
+
+	econf "${myeconfargs[@]}"
+}
+
+src_install() {
+	default
+
+	# No need to create this at build/install time
+	rm -r "${ED}"/var/run/ || die
+
+	# Fix paths in config file
+	sed -i \
+		-e "s:/usr/local/:${EPREFIX}/:" \
+		-e "s:/var/run/sagan:${EPREFIX}/run/sagan:" \
+		"${ED}"/etc/sagan.yaml || die
+
+	diropts -g sagan -o sagan -m 750
+	# bug #775902
+	keepdir /var/sagan/{,fifo}
+	keepdir /var/log/sagan/{,stats}
+
+	fowners sagan:sagan /var/log/sagan/{,stats}
+
+	touch "${ED}"/var/log/sagan/sagan.log || die
+	fowners sagan:sagan /var/log/sagan/sagan.log || die
+
+	newinitd "${FILESDIR}"/sagan.init-r1 sagan
+	newconfd "${FILESDIR}"/sagan.confd sagan
+
+	systemd_dounit "${FILESDIR}"/sagan.service
+	newtmpfiles "${FILESDIR}"/sagan.tmpfiles sagan.conf
+
+	insinto /etc/logrotate.d
+	newins "${FILESDIR}"/sagan.logrotate sagan
+
+	docinto examples
+	dodoc -r extra/*
+}
+
+pkg_preinst() {
+	# bug #775902 revealed that we need 750 on /var/log/sagan or e.g.
+	# logrotate will fail. Let's inform the user to fix up permissions
+	# in such a case.
+	#  (fperms won't modify the live filesystem.)
+	HAD_BROKEN_PERMS=0
+
+	if has_version "<app-admin/sagan-2.0.1-r4" ; then
+		HAD_BROKEN_PERMS=1
+	fi
+}
+
+pkg_postinst() {
+	tmpfiles_process sagan.conf
+
+	if [[ "${HAD_BROKEN_PERMS}" -eq 1 ]] ; then
+		ewarn "Please fix the permissions on ${EPREFIX}/var/log/sagan:"
+		ewarn "e.g. chmod 750 ${EPREFIX}/var/log/sagan"
+		ewarn "See bug #775902"
+	fi
+
+	if use smtp; then
+		ewarn "You have enabled smtp use flag. If you plan on using Sagan with"
+		ewarn "email, create valid writable home directory for user 'sagan'"
+		ewarn "For security reasons it was created with /dev/null home directory"
+	fi
+
+	einfo "For configuration assistance see"
+	einfo "http://wiki.quadrantsec.com/bin/view/Main/SaganHOWTO"
+}