You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

167 lines
6.2 KiB

##
## solr.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2020 OpenPKG Project <http://openpkg.org/>
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
##
# package information
Name: solr
Summary: Enterprise Indexing and Search Server
URL: http://lucene.apache.org/solr/
Vendor: Apache Software Foundation
Packager: OpenPKG Project
Distribution: OpenPKG Community
Class: PLUS
Group: Web
License: GPL
Version: 4.10.3
Release: 20150212
# list of sources
Source0: http://www.apache.org/dist/lucene/solr/%{version}/solr-%{version}.tgz
Source1: rc.solr
Patch0: solr.patch
# build information
BuildPreReq: OpenPKG, openpkg >= 20160101
PreReq: OpenPKG, openpkg >= 20160101, java, JAVA-JDK, apg, curl
%description
Solr is the popular, blazing fast open source enterprise search
platform from the Apache Lucene project. Its major features include
powerful full-text search, hit highlighting, faceted search, dynamic
clustering, database integration, rich document (e.g., Word, PDF)
handling, and geospatial search. Solr is highly scalable, providing
distributed search and index replication, and it powers the search
and navigation features of many of the world's largest internet
sites.
%track
prog solr = {
version = %{version}
url = http://www.apache.org/dist/lucene/solr/
regex = (\d+\.\d+\.\d+)/
}
%prep
%setup -q -n solr-%{version}
%patch -p0
%build
# substitute parameters
%{l_shtool} subst %{l_value -s -a} \
example/etc/jetty.xml \
example/contexts/solr-jetty-context.xml
# adjust distribution
mv example server
# strip down distribution
rm -f [A-Z]*
rm -rf client docs
rm -rf server/example* server/multicore server/logs server/work server/cloud-scripts server/solr-webapp
rmdir server/solr/bin
find . -name README.txt -print | xargs rm -f
find . -name CHANGES.txt -print | xargs rm -f
find . -name "*LICENSE*.txt" -print | xargs rm -f
find . -name "*NOTICE*.txt" -print | xargs rm -f
find . -name "*.orig" -print | xargs rm -f
%install
# create installation hierarchy
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/bin \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
$RPM_BUILD_ROOT%{l_prefix}/etc/solr/default \
$RPM_BUILD_ROOT%{l_prefix}/lib/solr \
$RPM_BUILD_ROOT%{l_prefix}/var/solr/run \
$RPM_BUILD_ROOT%{l_prefix}/var/solr/log \
$RPM_BUILD_ROOT%{l_prefix}/var/solr/tmp \
$RPM_BUILD_ROOT%{l_prefix}/var/solr/dat/default
# install distribution
cp -rp * $RPM_BUILD_ROOT%{l_prefix}/lib/solr/
# post-adjust installation for server environment
mv $RPM_BUILD_ROOT%{l_prefix}/lib/solr/server/solr/solr.xml \
$RPM_BUILD_ROOT%{l_prefix}/etc/solr/
mv $RPM_BUILD_ROOT%{l_prefix}/lib/solr/server/solr/collection1/conf \
$RPM_BUILD_ROOT%{l_prefix}/etc/solr/default/
rm -rf \
$RPM_BUILD_ROOT%{l_prefix}/lib/solr/server/solr
mv $RPM_BUILD_ROOT%{l_prefix}/lib/solr/server/etc/* \
$RPM_BUILD_ROOT%{l_prefix}/etc/solr/
ln -s \
../../../../etc/solr/jetty.xml \
$RPM_BUILD_ROOT%{l_prefix}/lib/solr/server/etc/
ln -s \
../../../../etc/solr/webdefault.xml \
$RPM_BUILD_ROOT%{l_prefix}/lib/solr/server/etc/
rm -f \
$RPM_BUILD_ROOT%{l_prefix}/lib/solr/server/webapps/solr.war
ln -s \
../../dist/solr-%{version}.war \
$RPM_BUILD_ROOT%{l_prefix}/lib/solr/server/webapps/solr.war
# install run-command script
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE rc.solr} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%config %{l_prefix}/etc/solr/*' \
'%config %{l_prefix}/etc/solr/*/*' \
'%config %{l_prefix}/etc/solr/*/*/*' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/solr' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/solr/*'
%files -f files
%clean
%post
if [ $1 -eq 1 ]; then
# display final hints on initial installation
( echo "By default, Solr runs its server process on IPv4 address"
echo "127.0.0.1, TCP port 8983. Start the Solr server by running:"
echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc solr start"
echo "Connect to the Solr admin console by visiting URL:"
echo " http://localhost:8983/solr/default/admin/"
) | %{l_rpmtool} msg -b -t notice
fi
if [ $1 -eq 2 ]; then
# after upgrade, restart service
eval `%{l_rc} solr status 2>/dev/null`
[ ".$solr_active" = .yes ] && %{l_rc} solr restart
fi
exit 0
%preun
if [ $1 -eq 0 ]; then
# before erase, stop service and remove runtime files
%{l_rc} solr stop 2>/dev/null
rm -rf $RPM_INSTALL_PREFIX/var/solr/run/* >/dev/null 2>&1 || true
rm -rf $RPM_INSTALL_PREFIX/var/solr/log/* >/dev/null 2>&1 || true
rm -rf $RPM_INSTALL_PREFIX/var/solr/tmp/* >/dev/null 2>&1 || true
rm -rf $RPM_INSTALL_PREFIX/var/solr/dat/default/* >/dev/null 2>&1 || true
fi
exit 0