-
Notifications
You must be signed in to change notification settings - Fork 145
merge sbisbee's work + configurable root dirs #148
base: master
Are you sure you want to change the base?
Changes from all commits
589cb88
c621d0e
5bf88e7
c307979
0b9cf6d
a082b15
4100865
08c0150
97a9e85
cb00be8
e4ae3e2
dba9760
a71a89e
c9a76e2
49a369d
717db0f
fa35de3
05e02dd
3eb06a5
87395a7
0a413b9
692ecd0
2988b7a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,6 +110,13 @@ | |
<tika-version>1.0</tika-version> | ||
<jetty-version>6.1.20</jetty-version> | ||
<http-version>4.0.1</http-version> | ||
<env>default</env> | ||
<destRootDir>/usr/local</destRootDir> | ||
<destVarDir>${destRootDir}/var</destVarDir> | ||
<destVarLibDir>${destVarDir}/lib</destVarLibDir> | ||
<destEtcDir>${destRootDir}/etc</destEtcDir> | ||
<destBinDir>${destRootDir}/bin</destBinDir> | ||
<destDocDir>${destRootDir}/share/doc</destDocDir> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd keep destRootDir and to do the /var etc thing where it's used. The abstraction here isn't useful as these variables almost never vary. It's only the top-level that is altered and {root}/etc, {root}/bin are assumed. |
||
</properties> | ||
<issueManagement> | ||
<system>github</system> | ||
|
@@ -179,6 +186,7 @@ | |
<manifest> | ||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries> | ||
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries> | ||
<mainClass>com.github.rnewson.couchdb.lucene.Main</mainClass> | ||
</manifest> | ||
</archive> | ||
</configuration> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,50 +6,54 @@ | |
</formats> | ||
<fileSets> | ||
<fileSet> | ||
<directory>${project.basedir}</directory> | ||
<outputDirectory>${destDocDir}/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>${destBinDir}</outputDirectory> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i.e, ${destRootDir}/bin |
||
</file> | ||
<file> | ||
<source>${project.basedir}/src/main/bin/kill_ppid</source> | ||
<fileMode>755</fileMode> | ||
<outputDirectory>/bin</outputDirectory> | ||
<outputDirectory>${destVarLibDir}/couchdb-lucene</outputDirectory> | ||
</file> | ||
<file> | ||
<source>${project.basedir}/src/main/resources/couchdb-lucene.ini</source> | ||
<fileMode>644</fileMode> | ||
<outputDirectory>/conf</outputDirectory> | ||
<outputDirectory>${destEtcDir}/couchdb-lucene</outputDirectory> | ||
</file> | ||
<file> | ||
<source>${project.basedir}/src/main/resources/log4j.xml</source> | ||
<fileMode>644</fileMode> | ||
<outputDirectory>/conf</outputDirectory> | ||
<outputDirectory>${destEtcDir}/couchdb-lucene</outputDirectory> | ||
</file> | ||
<file> | ||
<source>${project.basedir}/couchdb-external-hook.py</source> | ||
<fileMode>777</fileMode> | ||
<outputDirectory>/tools</outputDirectory> | ||
<fileMode>755</fileMode> | ||
<outputDirectory>${destBinDir}</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>${destEtcDir}/init.d</outputDirectory> | ||
</file> | ||
</files> | ||
<dependencySets> | ||
<dependencySet> | ||
<scope>runtime</scope> | ||
<outputDirectory>/lib</outputDirectory> | ||
<outputDirectory>${destVarLibDir}/couchdb-lucene</outputDirectory> | ||
</dependencySet> | ||
</dependencySets> | ||
</assembly> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is absolute, but should be relative to ${destRootDir} too. |
||
|
||
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 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[lucene] | ||
# The output directory for Lucene indexes. | ||
dir=indexes | ||
dir=/var/lib/couchdb-lucene/indexes | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is absolute, but should be relative to ${destRootDir} too. |
||
|
||
# The local host name that couchdb-lucene binds to | ||
host=localhost | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should add yourself too :)