app-admin/filebeat: version bump to 5.0.0
authorTomas Mozes <hydrapolic@gmail.com>
Sun, 6 Nov 2016 06:27:49 +0000 (06:27 +0000)
committerGöktürk Yüksek <gokturk@gentoo.org>
Thu, 1 Dec 2016 04:18:05 +0000 (23:18 -0500)
app-admin/filebeat/Manifest
app-admin/filebeat/filebeat-5.0.0.ebuild [new file with mode: 0644]
app-admin/filebeat/files/filebeat.confd-r1 [new file with mode: 0644]
app-admin/filebeat/files/filebeat.initd-r1 [new file with mode: 0644]

index d9e426fc89d0a19e8976b1094c2d34de26d44db2..dc72c576f79f62ea886357cf4129975f41634e29 100644 (file)
@@ -1 +1,2 @@
 DIST filebeat-1.3.1.tar.gz 10225540 SHA256 1d8e41b42a0b2dd59403795ff07cbfd8a9a76477731c38122aa9242b47b054e0 SHA512 60f6d4ae93bb01e74311d7ccc3d367707f888f58898b89a0ea7512c96b6e1369edf7dc2afe3615df97e8c311629d9fc1e9fc2f1abe8edcbb5bc5bcf47c82107c WHIRLPOOL 608b825fa4dc99d792deb9d23672eea0e66318461adb944dc484d42edc3d3acb1cf1f65cd4024cf0437dd5e5ed088ff5b5aeec967f7efad03b82f259793410f0
+DIST filebeat-5.0.0.tar.gz 15736495 SHA256 3e6b7cf2ee5f52e78ae87ef04ab9dd49977c89f86a09416586896aeaea844e34 SHA512 0838fb5e04d2266b15a6f21ebf1109626b60591a9154f4bb11cde73ae127a7695defb1e238a115ab59e0a7441bd9fa5642d4eb924663f00467b715224a3fa076 WHIRLPOOL a2b39bccfb45a32a25de9ae32ad881cd79e7a854280d6eb17614f4c274e9f92d956f8b811e6ff6371d16e7d723a98c59e82906d90029a25d079b33089142df5f
diff --git a/app-admin/filebeat/filebeat-5.0.0.ebuild b/app-admin/filebeat/filebeat-5.0.0.ebuild
new file mode 100644 (file)
index 0000000..34c08b5
--- /dev/null
@@ -0,0 +1,65 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+DESCRIPTION="Lightweight log shipper for Logstash and Elasticsearch"
+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"
+SLOT="0"
+KEYWORDS="~amd64"
+
+DEPEND="dev-lang/go"
+RDEPEND="!app-admin/filebeat-bin"
+
+ELASTIC="${WORKDIR}/src/github.com/elastic"
+BEATS="${ELASTIC}/beats"
+S="${BEATS}"
+
+src_unpack() {
+       mkdir -p "${ELASTIC}" || die
+       unpack ${P}.tar.gz
+       mv beats-${PV} "${BEATS}" || die
+}
+
+src_compile() {
+       cd ${BEATS}/filebeat || die
+       GOPATH="${WORKDIR}" emake
+}
+
+src_install() {
+       keepdir /var/{lib,log}/${PN}
+
+       fperms 0750 /var/{lib,log}/${PN}
+
+       newconfd "${FILESDIR}/${PN}.confd-r1" ${PN}
+       newinitd "${FILESDIR}/${PN}.initd-r1" ${PN}
+
+       insinto "/usr/share/doc/${PF}/examples"
+       doins ${PN}/{filebeat.yml,filebeat.full.yml}
+
+       insinto "/etc/${PN}"
+       doins ${PN}/{filebeat.template.json,filebeat.template-es2x.json}
+
+       exeinto "/usr/share/${PN}"
+       doexe libbeat/scripts/migrate_beat_config_1_x_to_5_0.py
+
+       dobin filebeat/filebeat
+}
+
+pkg_postinst() {
+       if [[ -n "${REPLACING_VERSIONS}" ]]; then
+               elog "Please read the migration guide at:"
+               elog "https://www.elastic.co/guide/en/beats/libbeat/5.0/upgrading.html"
+               elog ""
+               elog "The migration script:"
+               elog "${EROOT%/}/usr/share/filebeat/migrate_beat_config_1_x_to_5_0.py"
+               elog ""
+       fi
+
+       elog "Example configurations:"
+       elog "${EROOT%/}/usr/share/doc/${PF}/examples"
+}
diff --git a/app-admin/filebeat/files/filebeat.confd-r1 b/app-admin/filebeat/files/filebeat.confd-r1
new file mode 100644 (file)
index 0000000..2fcf41a
--- /dev/null
@@ -0,0 +1,15 @@
+# Run filebeat under this user/group
+#FILEBEAT_USER=""
+#FILEBEAT_GROUP=""
+
+# Configuration path
+#FILEBEAT_CONFIG=""
+
+# Path to data directory
+#FILEBEAT_DATADIR=""
+
+# Path to log directory
+#FILEBEAT_LOGDIR=""
+
+# Additional arguments passed to filebeat
+#FILEBEAT_OPTS=""
diff --git a/app-admin/filebeat/files/filebeat.initd-r1 b/app-admin/filebeat/files/filebeat.initd-r1
new file mode 100644 (file)
index 0000000..cec6142
--- /dev/null
@@ -0,0 +1,50 @@
+#!/sbin/openrc-run
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+FILEBEAT_USER="${FILEBEAT_USER:-root}"
+FILEBEAT_GROUP="${FILEBEAT_GROUP:-root}"
+FILEBEAT_CONFIG="${FILEBEAT_CONFIG:-/etc/filebeat/filebeat.yml}"
+FILEBEAT_DATADIR="${FILEBEAT_DATADIR:-/var/lib/filebeat}"
+FILEBEAT_LOGDIR="${FILEBEAT_LOGDIR:-/var/log/filebeat}"
+FILEBEAT_OPTS="${FILEBEAT_OPTS:-}"
+
+command="/usr/bin/filebeat"
+command_args="-c ${FILEBEAT_CONFIG} ${FILEBEAT_OPTS} -path.config $(dirname $FILEBEAT_CONFIG) \
+       -path.data ${FILEBEAT_DATADIR} -path.home ${FILEBEAT_DATADIR} -path.logs ${FILEBEAT_LOGDIR}"
+extra_commands="checkconfig"
+command_background="true"
+start_stop_daemon_args="--user ${FILEBEAT_USER}:${FILEBEAT_GROUP} \
+       --chdir ${FILEBEAT_DATADIR}"
+pidfile="/run/filebeat/filebeat.pid"
+
+depend() {
+       use net
+       after elasticsearch
+}
+
+checkconfig() {
+       if [[ ! -e ${FILEBEAT_CONFIG} ]]; then
+               eend "Please create a configuration file at ${FILEBEAT_CONFIG}"
+               return 1
+       fi
+
+       ebegin "Checking your configuration"
+       ${command} ${command_args} -configtest
+       eend $? "Configuration error. Please fix your configuration files."
+}
+
+start_pre() {
+       checkconfig || return 1
+
+       checkpath -d -o "${FILEBEAT_USER}":"${FILEBEAT_GROUP}" -m750 "$(dirname "${pidfile}")"
+       checkpath -d -o "${FILEBEAT_USER}":"${FILEBEAT_GROUP}" -m750 "${FILEBEAT_DATADIR}"
+       checkpath -d -o "${FILEBEAT_USER}":"${FILEBEAT_GROUP}" -m750 "${FILEBEAT_LOGDIR}"
+}
+
+stop() {
+       ebegin "Stopping filebeat"
+       start-stop-daemon --stop \
+               --pidfile=${pidfile} \
+               --retry=TERM/5/KILL/5
+}