view logstash.spec @ 1:59fe08a2fcbe

switch to flatjar.jar; fix sendmail patterns
author Carl Byington <carl@five-ten-sg.com>
date Fri, 01 Mar 2013 18:40:11 -0800
parents df4952a2fb06
children 9e0cdf091b8a
line wrap: on
line source

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

%define _bindir  /usr/local/bin

Summary:        A tool for managing your logs
Name:           logstash
Version:        1.1.9
Release:        0
License:        new BSD
Group:          Applications/Productivity
URL:            http://logstash.net/
BuildArch:      noarch
#Source0:       https://logstash.objects.dreamhost.com/release/%{name}-%{version}-monolithic.jar
Source0:        http://logstash.objects.dreamhost.com/release/%{name}-%{version}-flatjar.jar
Source1:        logstash.rc
Source2:        %{name}.conf
Source3:        apache.pattern
Source4:        sendmail.pattern
Requires:       httpd java-1.7.0-openjdk
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
BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)


%description
logstash tool for managing your logs


%prep
cp -p %SOURCE0 .
cp -p %SOURCE1 .
cp -p %SOURCE2 .
cp -p %SOURCE3 .
cp -p %SOURCE4 .


%build


%install
rm -rf $RPM_BUILD_ROOT
mkdir  -p $RPM_BUILD_ROOT/var/log/%{name}
install -D -m 640 apache.pattern                      $RPM_BUILD_ROOT/var/lib/%{name}/data/patterns/apache
install -D -m 640 sendmail.pattern                    $RPM_BUILD_ROOT/var/lib/%{name}/data/patterns/sendmail
install -D -m 755 %{name}.rc                          $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
#nstall -D -m 750 %{name}-%{version}-monolithic.jar   $RPM_BUILD_ROOT/%{_bindir}/%{name}.jar
install -D -m 750 %{name}-%{version}-flatjar.jar      $RPM_BUILD_ROOT/%{_bindir}/%{name}.jar
install -D -m 640 %{name}.conf                        $RPM_BUILD_ROOT/etc/%{name}/%{name}.conf


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


%post
/sbin/chkconfig --add %{name}
setfacl -m u:logstash:rx /var/log/httpd
setfacl -m u:logstash:r  /var/log/messages
setfacl -m u:logstash:r  /var/log/maillog


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


%postun
[ $1 = 0 ] && setfacl -x u:logstash /var/log/httpd    || :
[ $1 = 0 ] && setfacl -x u:logstash /var/log/messages || :
[ $1 = 0 ] && setfacl -x u:logstash /var/log/maillog  || :
[ $1 = 0 ] && userdel %{name} || :


%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%attr(0750,%{name},root) %{_bindir}/*
%config(noreplace) %attr(0750,%{name},root) /etc/%{name}
%config(noreplace) %attr(0640,%{name},root) /etc/%{name}/%{name}.conf
/etc/rc.d/init.d/%{name}
%dir %attr(0750,%{name},root) /var/log/%{name}
%dir %attr(0750,%{name},root) /var/lib/%{name}
%dir %attr(0750,%{name},root) /var/lib/%{name}/data
%dir %attr(0750,%{name},root) /var/lib/%{name}/data/patterns
%config(noreplace) %attr(0640,%{name},root) /var/lib/%{name}/data/patterns/sendmail
%config(noreplace) %attr(0640,%{name},root) /var/lib/%{name}/data/patterns/apache


%changelog
* Fri Feb 29 2013  <carl@five-ten-sg.com> - 1.1.9-0
- Initial build.