Skip to content

Commit

Permalink
Merge remote branch 'sbisbee/master' into ubuntu
Browse files Browse the repository at this point in the history
Conflicts:
	THANKS.md
	src/main/assembly/dist.xml
	src/main/bin/run
  • Loading branch information
Tim Kuijsten committed Dec 21, 2011
2 parents 958d492 + 0a413b9 commit 692ecd0
Show file tree
Hide file tree
Showing 6 changed files with 191 additions and 127 deletions.
1 change: 1 addition & 0 deletions THANKS.md
Expand Up @@ -2,3 +2,4 @@
* Thanks to Adam Lofts for the performance boosting JSONDocumentAdapter et al.
* Thanks to Santiago M. Mola for the termvector option.
* Thanks to Joe Hillenbrand for adding default result limit to config.
* Thanks to Sam Bisbee.
1 change: 1 addition & 0 deletions pom.xml
Expand Up @@ -179,6 +179,7 @@
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
<mainClass>com.github.rnewson.couchdb.lucene.Main</mainClass>
</manifest>
</archive>
</configuration>
Expand Down
30 changes: 17 additions & 13 deletions src/main/assembly/dist.xml
Expand Up @@ -6,50 +6,54 @@
</formats>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>/usr/share/doc/couchdb-lucene</outputDirectory>
<includes>
<include>${project.basedir}/README*</include>
<include>${project.basedir}/LICENSE*</include>
<include>${project.basedir}/NOTICE*</include>
<include>README*</include>
<include>LICENSE*</include>
<include>NOTICE*</include>
<include>BREAKING_CHANGES*</include>
<include>TODO*</include>
<include>THANKS*</include>
</includes>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
<source>${project.basedir}/src/main/bin/run</source>
<source>${project.basedir}/src/main/bin/couchdb-lucene</source>
<fileMode>755</fileMode>
<outputDirectory>/bin</outputDirectory>
<outputDirectory>/usr/local/bin</outputDirectory>
</file>
<file>
<source>${project.basedir}/src/main/bin/kill_ppid</source>
<fileMode>755</fileMode>
<outputDirectory>/bin</outputDirectory>
<outputDirectory>/usr/local/bin</outputDirectory>
</file>
<file>
<source>${project.basedir}/src/main/resources/couchdb-lucene.ini</source>
<fileMode>644</fileMode>
<outputDirectory>/conf</outputDirectory>
<outputDirectory>/etc/couchdb-lucene</outputDirectory>
</file>
<file>
<source>${project.basedir}/src/main/resources/log4j.xml</source>
<fileMode>644</fileMode>
<outputDirectory>/conf</outputDirectory>
<outputDirectory>/etc/couchdb-lucene</outputDirectory>
</file>
<file>
<source>${project.basedir}/couchdb-external-hook.py</source>
<fileMode>777</fileMode>
<outputDirectory>/tools</outputDirectory>
<fileMode>755</fileMode>
<outputDirectory>/usr/local/bin</outputDirectory>
</file>
<file>
<source>${project.basedir}/src/main/tools/etc/init.d/couchdb-lucene</source>
<fileMode>755</fileMode>
<outputDirectory>/tools/etc/init.d/couchdb-lucene</outputDirectory>
<outputDirectory>/etc/init.d</outputDirectory>
</file>
</files>
<dependencySets>
<dependencySet>
<scope>runtime</scope>
<outputDirectory>/lib</outputDirectory>
<outputDirectory>/lib/couchdb-lucene</outputDirectory>
</dependencySet>
</dependencySets>
</assembly>
90 changes: 90 additions & 0 deletions src/main/bin/couchdb-lucene
@@ -0,0 +1,90 @@
#!/bin/sh

NAME="couchdb-lucene"
BACKGROUND=false #whether to run in the background or not
STDOUT_FILE="" #where to send background stdout to (defaults to &1)
PID_FILE=/var/run/couchdb-lucene/couchdb-lucene.pid

SCRIPT_OK=0
SCRIPT_ERROR=1

printUsage()
{
cat << EOF
Usage: `$basename $0` [OPTIONS]
Starts the couchdb-lucene server component.
Options:
-h displays this short help message and exits
-b spawn as a background process
-o FILE redirect background process's stdout to FILE (defaults to none)
-p FILE set the background process's PID FILE
EOF
}

getPid()
{
[ -f $PID_FILE ] && PID=`cat $PID_FILE`
echo $PID
}

start()
{
CLASSPATH="$CL_BASEDIR/etc/couchdb-lucene:$CL_BASEDIR/lib/couchdb-lucene/*"
JAVA_OPTS="-server -Xmx1g -cp $CLASSPATH"

command="java $JAVA_OPTS $JAR com.github.rnewson.couchdb.lucene.Main"

if [ "$BACKGROUND" != "true" ]
then
eval $command
else
PID=`getPid`

if [ -z "$PID" ]
then
[ -n $STDOUT_FILE ] && command="$command >> $STDOUT_FILE"

eval "$command &"
echo $! > $PID_FILE
else
echo "$NAME is already running ($PID_FILE)."
fi
fi
}

checkEnvironment()
{
prepend="couchdb-lucene needs write access to"
[ ! -w $STDOUT_FILE ] && echo "$prepend output file $STDOUT_FILE" && exit $SCRIPT_ERROR
unset prepend
}

parseOptions()
{
opts=`getopt o:hbp: $@`
set -- $opts
while [ $# -gt 0 ]
do
case "$1" in
-h) shift; printUsage; exit $SCRIPT_OK;;
-o) shift; STDOUT_FILE="$1"; shift;;
-b) shift; BACKGROUND=true;;
-p) shift; PID_FILE="$1"; shift;;
--) shift; break;;
*) echo "Unknown option: $1" >&2; exit $SCRIPT_ERROR;;
esac
done
}

parseOptions $@
checkEnvironment

[ -z $CL_BASEDIR ] && CL_BASEDIR=`dirname "$0"`"/.."
cd $CL_BASEDIR

start

2 changes: 1 addition & 1 deletion src/main/resources/couchdb-lucene.ini
@@ -1,6 +1,6 @@
[lucene]
# The output directory for Lucene indexes.
dir=indexes
dir=/var/lib/couchdb-lucene/indexes

# The local host name that couchdb-lucene binds to
host=localhost
Expand Down

0 comments on commit 692ecd0

Please sign in to comment.