diff --git a/.gitignore b/.gitignore index 941c9a5..180efb4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,9 @@ +misc/segments4 +misc/customprofiles target/ *.BAK .classpath .project *.class .idea/ -*.iml \ No newline at end of file +*.iml diff --git a/misc/scripts/standalone/server.sh b/misc/scripts/standalone/server.sh index 9ea86a8..9a439ed 100755 --- a/misc/scripts/standalone/server.sh +++ b/misc/scripts/standalone/server.sh @@ -6,6 +6,26 @@ cd "$(dirname "$0")" # maxRunningTime is the request timeout in seconds, set to 0 to disable timeout JAVA_OPTS="-Xmx128M -Xms128M -Xmn8M -DmaxRunningTime=300" -CLASSPATH=../brouter.jar -java $JAVA_OPTS -cp $CLASSPATH btools.server.RouteServer ../segments4 ../profiles2 ../customprofiles 17777 1 $BINDADDRESS +# If paths are unset, first search in locations matching the directory structure +# as found in the official BRouter zip archive +CLASSPATH=${CLASSPATH:-"../brouter.jar"} +SEGMENTSPATH=${SEGMENTSPATH:-"../segments4"} +PROFILESPATH=${PROFILESPATH:-"../profiles2"} +CUSTOMPROFILESPATH=${CUSTOMPROFILESPATH:-"../customprofiles"} + +# Otherwise try to locate files inside the source checkout +if [ ! -e "$CLASSPATH" ]; then + CLASSPATH="$(ls ../../../brouter-server/target/brouter-server-*jar-with-dependencies.jar | sort --reverse --version-sort | head --lines 1)" +fi +if [ ! -e "$SEGMENTSPATH" ]; then + SEGMENTSPATH="../../segments4" +fi +if [ ! -e "$PROFILESPATH" ]; then + PROFILESPATH="../../profiles2" +fi +if [ ! -e "$CUSTOMPROFILESPATH" ]; then + CUSTOMPROFILESPATH="../../customprofiles" +fi + +java $JAVA_OPTS -cp $CLASSPATH btools.server.RouteServer "$SEGMENTSPATH" "$PROFILESPATH" "$CUSTOMPROFILESPATH" 17777 1 $BINDADDRESS