view Kibana.spec @ 26:610835fb4209

external configuration for kibana
author Carl Byington <carl@five-ten-sg.com>
date Fri, 03 May 2013 08:04:08 -0700
parents d058481276aa
children 76544ad0561d
line wrap: on
line source

# prevent brp repack jar files
%define __os_install_post %{nil}

%global commit df8ae2344433e5072a8dfe77082acfd1c9b6ed62
%global shortcommit %(c=%{commit}; echo ${c:0:8})
%global name2 kibana

Name:           Kibana
Version:        0.2.0
Release:        0%{?dist}
Summary:        Kibana is a user friendly way to view, search and visualize your log data

Group:          System Environment/Daemons
License:        MIT
URL:            http://kibana.org/
BuildArch:      noarch
Source0:        https://nodeload.github.com/rashidkpc/Kibana/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz
Source1:        Kibana-external-config-patch
Source10:       %{name}.rc
Source13:       %{name}.sysconfig
BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
Autoreq:        0

BuildRequires:  jruby java-devel

Requires:       jruby java-devel elasticsearch logstash
Requires(pre):          /usr/sbin/useradd
Requires(pre):          /usr/bin/getent
Requires(postun):       /usr/sbin/userdel
Requires(post,preun):   /sbin/chkconfig
Requires(post,preun):   /sbin/service

%description
Kibana is a highly scalable interface for Logstash and ElasticSearch
that allows you to efficiently search, graph, analyze and otherwise
make sense of a mountain of logs.


%prep
%setup -qn %{name}-%{commit}
patch <%SOURCE1


%build
if [ "$(which jruby)" == '' ]; then
    JRUBY_CMD="java -jar /usr/share/jruby.jar"
else
    JRUBY_CMD="jruby"
fi
export GEM_HOME=$(pwd)
export GEM_PATH=
$JRUBY_CMD -S gem install bundler
$JRUBY_CMD bin/bundle install
rm -rf gems/*/test
rm -rf gems/*/spec
rm -rf gems/*/examples
rm -rf sample spec


%install
rm -rf                          $RPM_BUILD_ROOT
install -d                      $RPM_BUILD_ROOT/var/log/%{name}
install -d                      $RPM_BUILD_ROOT/%{_javadir}/%{name}
cp -a *                         $RPM_BUILD_ROOT/%{_javadir}/%{name}
install -D -m 755 %SOURCE10     $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
install -D -m 640 %SOURCE13     $RPM_BUILD_ROOT/etc/sysconfig/%{name}


%pre
/usr/bin/getent passwd %{name2} >/dev/null || /usr/sbin/useradd -r -c "%{name} pseudo-user" %{name2} >/dev/null


%post
/sbin/chkconfig --add %{name}


%preun
[ $1 = 0 ] && /sbin/service %{name} stop    || :
[ $1 = 0 ] && /sbin/chkconfig --del %{name} || :


%postun
[ $1 = 0 ] && userdel %{name2} || :


%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%attr(0750,%{name2},root) %{_javadir}/*
%config(noreplace) %attr(0640,%{name2},root) /etc/sysconfig/%{name}
%dir %attr(0750,%{name2},root) /var/log/%{name}
/etc/rc.d/init.d/%{name}



%changelog
* Fri Apr 25 2013  <carl@five-ten-sg.com> - 0.2.0-0
- Initial build.