[gentoo-commits] repo/gentoo:master commit in: app-admin/filebeat-bin/, app-admin/filebeat-bin/files/

2015-12-09 Thread Ian Delaney
commit: c846729fc6ea0db39ec9ea2496cc55a00bbcfdd7
Author: Tomas Mozes  sygic  com>
AuthorDate: Mon Dec  7 12:29:57 2015 +
Commit: Ian Delaney  gentoo  org>
CommitDate: Mon Dec  7 12:29:57 2015 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c846729f

app-admin/filebeat-bin: new ebuild

 app-admin/filebeat-bin/Manifest   |  2 +
 app-admin/filebeat-bin/filebeat-bin-1.0.0.ebuild  | 53 +++
 app-admin/filebeat-bin/files/filebeat.confd   |  5 +++
 app-admin/filebeat-bin/files/filebeat.initd   | 47 
 app-admin/filebeat-bin/files/filebeat.yml.example | 14 ++
 app-admin/filebeat-bin/metadata.xml   | 10 +
 6 files changed, 131 insertions(+)

diff --git a/app-admin/filebeat-bin/Manifest b/app-admin/filebeat-bin/Manifest
new file mode 100644
index 000..430abbc
--- /dev/null
+++ b/app-admin/filebeat-bin/Manifest
@@ -0,0 +1,2 @@
+DIST filebeat-1.0.0-i686.tar.gz 3069805 SHA256 
f184fe7d5cd566bdf1a48f79cd52c0d3ef960782b2076e8df67836e0ed36dc37 SHA512 
c4df33524249aef574f923c67be56e22f8eb24a51933178a90b080cc59aec772052c653bf551f198c08e63c7cb03fa9f346dc7c5cee31c586270c532655486df
 WHIRLPOOL 
e2be905de1aa0749bfb419bff50fc1952dc7dc5b2d127045709f08e6e6cb38faae1372d64515c4157949138cdbd10888aea0e0fe4e98f57d69a73873eb578483
+DIST filebeat-1.0.0-x86_64.tar.gz 3260387 SHA256 
f0bcc2dc9ae720a672fe5f4b22c0d132f7131d4d07484f4100453c7122f0561a SHA512 
823450554ec6d7ae43ff064e967ad8d5bef95077404738feac7f7ae5ef74000e051042ea3734423b883bab9102d90a4e707d9c0d03c88abe2f34862f02d01ed4
 WHIRLPOOL 
5a6b9b532d090a87724f17af3727cca772f48602c39cb9d82593f3c4f4ab722f295db647ba4d0152bf3baa41134b5561c2e9655a02d47c25e228af64122e3609

diff --git a/app-admin/filebeat-bin/filebeat-bin-1.0.0.ebuild 
b/app-admin/filebeat-bin/filebeat-bin-1.0.0.ebuild
new file mode 100644
index 000..9d51925
--- /dev/null
+++ b/app-admin/filebeat-bin/filebeat-bin-1.0.0.ebuild
@@ -0,0 +1,53 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+MY_PN=${PN/-bin/}
+MY_P=${MY_PN}-${PV}
+
+DESCRIPTION="Lightweight log shipper for Logstash and Elasticsearch"
+HOMEPAGE="https://www.elastic.co/products/beats;
+SRC_URI="amd64? ( 
https://download.elastic.co/beats/${MY_PN}/${MY_P}-x86_64.tar.gz )
+   x86? ( https://download.elastic.co/beats/${MY_PN}/${MY_P}-i686.tar.gz )"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND=""
+RDEPEND="${DEPEND}"
+
+src_unpack() {
+   if use amd64; then
+   S="${WORKDIR}/${MY_P}-x86_64"
+   elif use x86; then
+   S="${WORKDIR}/${MY_P}-i686"
+   fi
+
+   default
+}
+
+src_install() {
+   keepdir /etc/${MY_PN}
+   keepdir /var/lib/${MY_PN}
+
+   fperms 0750 /var/lib/${MY_PN}
+
+   insinto /etc/${MY_PN}
+   doins "${FILESDIR}/filebeat.yml.example"
+
+   newconfd "${FILESDIR}/${MY_PN}.confd" ${MY_PN}
+   newinitd "${FILESDIR}/${MY_PN}.initd" ${MY_PN}
+
+   dobin ${MY_PN}
+}
+
+pkg_postinst() {
+   if [[ ! -e /etc/${MY_PN}/${MY_PN}.yml ]]; then
+   elog "Before starting filebeat, you need to create a 
configuration file at:"
+   elog "/etc/${MY_PN}/${MY_PN}.yml"
+   fi
+}

diff --git a/app-admin/filebeat-bin/files/filebeat.confd 
b/app-admin/filebeat-bin/files/filebeat.confd
new file mode 100644
index 000..188f447
--- /dev/null
+++ b/app-admin/filebeat-bin/files/filebeat.confd
@@ -0,0 +1,5 @@
+#FILEBEAT_USER=""
+#FILEBEAT_GROUP=""
+#FILEBEAT_CONFIG=""
+#FILEBEAT_STATEDIR=""
+#FILEBEAT_OPTS=""

diff --git a/app-admin/filebeat-bin/files/filebeat.initd 
b/app-admin/filebeat-bin/files/filebeat.initd
new file mode 100644
index 000..3ffc340
--- /dev/null
+++ b/app-admin/filebeat-bin/files/filebeat.initd
@@ -0,0 +1,47 @@
+#!/sbin/openrc-run
+# Copyright 1999-2015 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_STATEDIR="${FILEBEAT_STATEDIR:-/var/lib/filebeat}"
+FILEBEAT_OPTS="${FILEBEAT_OPTS:-}"
+
+command="/usr/bin/filebeat"
+command_args="${FILEBEAT_OPTS}"
+extra_commands="checkconfig"
+command_background="true"
+start_stop_daemon_args="--user ${FILEBEAT_USER}:${FILEBEAT_GROUP} \
+   --chdir ${FILEBEAT_STATEDIR}"
+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
+
+   

[gentoo-commits] repo/gentoo:master commit in: app-admin/filebeat-bin/, app-admin/filebeat-bin/files/

2015-12-09 Thread Ian Delaney
commit: bae0c59491f65eb518201b3ddec7a88d179cc830
Author: Tomas Mozes  sygic  com>
AuthorDate: Mon Dec  7 14:27:07 2015 +
Commit: Ian Delaney  gentoo  org>
CommitDate: Mon Dec  7 14:27:07 2015 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bae0c594

app-admin/filebeat-bin: use bundled example config

 app-admin/filebeat-bin/filebeat-bin-1.0.0.ebuild  |  6 +++---
 app-admin/filebeat-bin/files/filebeat.yml.example | 14 --
 2 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/app-admin/filebeat-bin/filebeat-bin-1.0.0.ebuild 
b/app-admin/filebeat-bin/filebeat-bin-1.0.0.ebuild
index 9d51925..a6d18e4 100644
--- a/app-admin/filebeat-bin/filebeat-bin-1.0.0.ebuild
+++ b/app-admin/filebeat-bin/filebeat-bin-1.0.0.ebuild
@@ -36,12 +36,12 @@ src_install() {
 
fperms 0750 /var/lib/${MY_PN}
 
-   insinto /etc/${MY_PN}
-   doins "${FILESDIR}/filebeat.yml.example"
-
newconfd "${FILESDIR}/${MY_PN}.confd" ${MY_PN}
newinitd "${FILESDIR}/${MY_PN}.initd" ${MY_PN}
 
+   insinto /etc/${MY_PN}
+   newins ${MY_PN}.yml ${MY_PN}.yml.example
+
dobin ${MY_PN}
 }
 

diff --git a/app-admin/filebeat-bin/files/filebeat.yml.example 
b/app-admin/filebeat-bin/files/filebeat.yml.example
deleted file mode 100644
index 06c599c..000
--- a/app-admin/filebeat-bin/files/filebeat.yml.example
+++ /dev/null
@@ -1,14 +0,0 @@
-filebeat:
-  prospectors:
-  -
-  paths:
-- /var/log/*.log
-- /var/log/debug
-- /var/log/messages
-- /var/log/syslog
-  input_type: log
-
-output:
-  elasticsearch:
-hosts: ["localhost:9200"]
-index: "logstash"