riak_search / package / rpm / SPECS / riak-search.spec

The default branch has multiple heads

Full commit
# _revision, _release, and _version  should be defined on the rpmbuild command
# line like so:
# --define "_version 0.9.1" --define "_release 7" \
# --define "_revision 0.9.1-19-abcdef"

%define appname		riaksearch
%define appuser		riak

Name: riak-search
Version: %{_version}
Release: %{_release}%{?dist}
License: Proprietary
Group: Development/Libraries
Source: %{name}-%{_revision}.tar.gz
Source1: riaksearch_init
Vendor: Basho Technologies
Packager: Basho Technologies <>
BuildRoot: %{_tmppath}/%{name}-%{_revision}-%{release}-root
Summary: Riak Distributed Scaling Search

Riak is a distrubuted data store.

%define riak_lib %{_libdir}/%{appname}
%define init_script %{_sysconfdir}/init.d/%{appname}

%define __prelink_undo_cmd /bin/cat prelink library

%setup -q -n %{_repo}-%{_revision}
cat > rel/vars.config <<EOF
% app.config
{ring_state_dir, "%{_localstatedir}/lib/%{appname}/ring"}.
{web_ip,       ""}.
{web_port,     8098}.
{handoff_port, 8099}.
{pb_ip,        ""}.
{pb_port,      8087}.
{bitcask_data_root, "%{_localstatedir}/lib/%{appname}/bitcask"}.
{merge_index_data_root,  "%{_localstatedir}/lib/%{appname}/merge_index"}.
{analyzer_conns,    50}.
{analyzer_port,     6095}.
{sasl_error_log, "%{_localstatedir}/log/%{appname}/sasl-error.log"}.
{sasl_log_dir, "%{_localstatedir}/log/%{appname}/sasl"}.
{mapred_queue_dir, "%{_localstatedir}/lib/%{appname}/mr_queue"}.
{map_js_vms,   8}.
{reduce_js_vms, 6}.
{hook_js_vms, 2}.
% vm.args
{node,         "riak@"}.
{crash_dump,   "%{_localstatedir}/log/%{appname}/erl_crash.dump"}.
% bin/riak*
{runner_script_dir,  "/usr/sbin"}.
{runner_base_dir,    "%{riak_lib}"}.
{runner_etc_dir,     "%{_sysconfdir}/%{appname}"}.
{runner_log_dir,     "%{_localstatedir}/log/%{appname}"}.
{pipe_dir,           "%{_localstatedir}/run/%{appname}/"}.
{runner_user,        "%{appuser}"}.

#mkdir %{appname}
make rel

%define releasepath	%{_builddir}/%{buildsubdir}/rel/%{appname}

mkdir -p %{buildroot}%{_sysconfdir}/%{appname}
mkdir -p %{buildroot}%{riak_lib}
mkdir -p %{buildroot}%{_mandir}/man1
mkdir -p %{buildroot}%{_localstatedir}/lib/%{appname}/bitcask
mkdir -p %{buildroot}%{_localstatedir}/lib/%{appname}/merge_index
mkdir -p %{buildroot}%{_localstatedir}/lib/%{appname}/ring
mkdir -p %{buildroot}%{_localstatedir}/log/%{appname}/sasl
mkdir -p %{buildroot}%{_localstatedir}/run/%{appname}
mkdir -p %{buildroot}%{_localstatedir}/lib/%{name}/mr_queue

#Copy all necessary lib files etc.
cp -r %{releasepath}/lib %{buildroot}%{riak_lib}
cp -r %{releasepath}/erts-* %{buildroot}%{riak_lib}
cp -r %{releasepath}/releases %{buildroot}%{riak_lib}
cp -r $RPM_BUILD_DIR/%{_repo}-%{_revision}/doc/man/man1/*.gz \
install -p -D -m 0644 \
		%{releasepath}/etc/app.config \
install -p -D -m 0644 \
		%{releasepath}/etc/vm.args \
install -p -D -m 0755 \
		%{releasepath}/bin/%{appname} \
install -p -D -m 0755 \
		%{releasepath}/bin/%{appname}-admin \
install -p -D -m 0755 \
		%{releasepath}/bin/search-cmd \
install -p -D -m 0755 \
    %{SOURCE1} %{buildroot}/%{init_script}

# Needed to work around check-rpaths which seems to be hardcoded into recent
# RPM releases
export QA_RPATHS=3

# create riak group only if it doesn't already exist
if ! getent group %{appuser} >/dev/null 2>&1; then
        groupadd -r %{appuser}

# create riak user only if it doesn't already exist
if getent passwd %{appuser} >/dev/null 2>&1; then
	# make sure it has the right home dir if the user already exists
	usermod -d %{_localstatedir}/lib/%{appname} %{appuser}
        useradd -r -g %{appuser} --home %{_localstatedir}/lib/%{appname} \
        usermod -c "Riak Server" %{appuser}

%dir %{_sysconfdir}/%{appname}
%config(noreplace) %{_sysconfdir}/%{appname}/*
%attr(0755,root,root) %{init_script}
%attr(0755,root,root) %{_sbindir}/%{appname}
%attr(0755,root,root) %{_sbindir}/%{appname}-admin
%attr(0755,root,root) %{_sbindir}/search-cmd
%attr(0644,root,root) %{_mandir}/man1/*

rm -rf %{buildroot}

* Mon Jul 12 2010 Ryan Tilder <> 0.12.0rc1
- Stop patching scripts since rebar will now templatize files

* Tue May 18 2010 Ryan Tilder <> 112rc3-1
- Tweak for riak-ee

* Wed May 12 2010 Ryan Tilder <> 0.10.1-3
- Tweak how bin/riak, bin/riak-admin, and bin/app.config are being modified
  for packaging

* Wed Mar 24 2010 Ryan Tilder <> 0.9.1-2
- Some simplification and tweaks

* Wed Mar 10 2010 Grant Schofield <> 0.9.0-1
- First 0.9 build