Browse Source

new package

master
parent
commit
0e70a7aea2
  1. 63
      solr/rc.solr
  2. 43
      solr/solr.patch
  3. 150
      solr/solr.spec

63
solr/rc.solr

@ -0,0 +1,63 @@
#!@l_prefix@/bin/openpkg rc
##
## rc.solr -- Run-Commands
##
%config
solr_enable="$openpkg_rc_def"
solr_log_prolog="true"
solr_log_epilog="true"
solr_log_numfiles="10"
solr_log_minsize="1M"
solr_log_complevel="9"
%common
solr_pidfile="@l_prefix@/var/solr/run/solr.pid"
solr_logfile="@l_prefix@/var/solr/log/solr.log"
solr_signal () {
[ -f $solr_pidfile ] && kill -$1 `cat $solr_pidfile`
}
%status -u @l_rusr@ -o
solr_usable="unknown"
solr_active="no"
rcService solr enable yes && \
solr_signal 0 && solr_active="yes"
echo "solr_enable=\"$solr_enable\""
echo "solr_usable=\"$solr_usable\""
echo "solr_active=\"$solr_active\""
%start -u @l_rusr@
rcService solr enable yes || exit 0
rcService solr active yes && exit 0
cmd="cd @l_prefix@/lib/solr/server &&"
cmd="$cmd nohup @l_prefix@/bin/java"
cmd="$cmd -Dsolr.solr.home=@l_prefix@/lib/solr/server/solr"
cmd="$cmd -Dsolr.data.dir=@l_prefix@/var/solr/dat"
cmd="$cmd -Djavax.servlet.context.tempdir=@l_prefix@/var/solr/app"
cmd="$cmd -jar start.jar"
( eval "$cmd </dev/null >>$solr_logfile 2>&1 &"
echo $! >$solr_pidfile
) >/dev/null 2>&1
%stop -u @l_rusr@
rcService solr enable yes || exit 0
rcService solr active no && exit 0
solr_signal TERM
sleep 2
rm -f $solr_pidfile >/dev/null 2>&1 || true
%restart -u @l_rusr@
rcService solr enable yes || exit 0
rcService solr active no && exit 0
rc solr stop start
%daily -u @l_susr@
rcService solr enable yes || exit 0
shtool rotate -f \
-n ${solr_log_numfiles} -s ${solr_log_minsize} -d \
-z ${solr_log_complevel} -m 664 -o @l_rusr@ -g @l_rgrp@ \
-P "${solr_log_prolog}" \
-E "${solr_log_epilog}; rc solr restart" \
$solr_logfile

43
solr/solr.patch

@ -0,0 +1,43 @@
Index: example/etc/jetty.xml
--- example/etc/jetty.xml.orig 2011-06-26 13:25:56.000000000 +0200
+++ example/etc/jetty.xml 2011-07-30 12:06:11.000000000 +0200
@@ -52,7 +52,7 @@
<Call name="addConnector">
<Arg>
<New class="org.mortbay.jetty.nio.SelectChannelConnector">
- <Set name="host"><SystemProperty name="jetty.host" /></Set>
+ <Set name="host"><SystemProperty name="jetty.host" default="127.0.0.1"/></Set>
<Set name="port"><SystemProperty name="jetty.port" default="8983"/></Set>
<Set name="maxIdleTime">30000</Set>
<Set name="Acceptors">2</Set>
@@ -71,7 +71,7 @@
<Call name="addConnector">
<Arg>
<New class="org.mortbay.jetty.bio.SocketConnector">
- <Set name="host"><SystemProperty name="jetty.host" /></Set>
+ <Set name="host"><SystemProperty name="jetty.host" default="127.0.0.1"/></Set>
<Set name="port"><SystemProperty name="jetty.port" default="8983"/></Set>
<Set name="maxIdleTime">50000</Set>
<Set name="lowResourceMaxIdleTime">1500</Set>
@@ -201,11 +201,10 @@
<!-- contexts configuration (see $(jetty.home)/contexts/test.xml -->
<!-- for an example). -->
<!-- =========================================================== -->
- <!--
<Ref id="RequestLog">
<Set name="requestLog">
<New id="RequestLogImpl" class="org.mortbay.jetty.NCSARequestLog">
- <Set name="filename"><SystemProperty name="jetty.logs" default="./logs"/>/yyyy_mm_dd.request.log</Set>
+ <Set name="filename"><SystemProperty name="jetty.logs" default="@l_prefix@/var/solr/log/jetty.log"/></Set>
<Set name="filenameDateFormat">yyyy_MM_dd</Set>
<Set name="retainDays">90</Set>
<Set name="append">true</Set>
@@ -215,7 +214,7 @@
</New>
</Set>
</Ref>
- -->
+
<!-- =========================================================== -->
<!-- extra options -->
<!-- =========================================================== -->

150
solr/solr.spec

@ -0,0 +1,150 @@
##
## solr.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2011 OpenPKG Foundation e.V. <http://openpkg.net/>
##
## 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 Foundation e.V.
Distribution: OpenPKG Community
Class: EVAL
Group: Web
License: GPL
Version: 3.3.0
Release: 20110730
# list of sources
Source0: http://www.apache.org/dist//lucene/solr/%{version}/apache-solr-%{version}.tgz
Source1: rc.solr
Patch0: solr.patch
# build information
BuildPreReq: OpenPKG, openpkg >= 20100101
PreReq: OpenPKG, openpkg >= 20100101, java, JAVA-JDK
%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 apache-solr-%{version}
%patch -p0
%build
# substitute parameters
%{l_shtool} subst %{l_value -s -a} example/etc/jetty.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
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
%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 \
$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/app \
$RPM_BUILD_ROOT%{l_prefix}/var/solr/dat
# install distribution
cp -rp * $RPM_BUILD_ROOT%{l_prefix}/lib/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/apache-solr-%{version}.war $RPM_BUILD_ROOT%{l_prefix}/lib/solr/server/webapps/solr.war
mv $RPM_BUILD_ROOT%{l_prefix}/lib/solr/server/solr/conf/* $RPM_BUILD_ROOT%{l_prefix}/etc/solr/
rmdir $RPM_BUILD_ROOT%{l_prefix}/lib/solr/server/solr/conf
ln -s ../../../../etc/solr $RPM_BUILD_ROOT%{l_prefix}/lib/solr/server/solr/conf
# 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/*/*' \
'%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/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/app/* >/dev/null 2>&1 || true
rm -rf $RPM_INSTALL_PREFIX/var/solr/dat/* >/dev/null 2>&1 || true
fi
exit 0
Loading…
Cancel
Save