1 | #!/bin/sh
|
---|
2 |
|
---|
3 | # Config files can define several variables used throughout this script.
|
---|
4 | # JAVACMD - The java command to launch osmosis.
|
---|
5 | # JAVACMD_OPTIONS - The options to append to the java command, typically used to modify jvm settings such as max memory.
|
---|
6 |
|
---|
7 | if [ -f /etc/osmosis ] ; then
|
---|
8 | . /etc/osmosis
|
---|
9 | fi
|
---|
10 |
|
---|
11 | if [ -f "$HOME/.osmosis" ] ; then
|
---|
12 | . "$HOME/.osmosis"
|
---|
13 | fi
|
---|
14 |
|
---|
15 | if [ -z "$JAVACMD" ] ; then
|
---|
16 | # No JAVACMD provided in osmosis config files, therefore default to java
|
---|
17 | JAVACMD=java
|
---|
18 | fi
|
---|
19 |
|
---|
20 | ## resolve links - $0 may be a link to application
|
---|
21 | PRG="$0"
|
---|
22 |
|
---|
23 | # if started without absolute path, but from PATH environment
|
---|
24 | if [ ! -s "$PRG" ] ; then
|
---|
25 | PRG=`which $PRG`
|
---|
26 | fi
|
---|
27 |
|
---|
28 | # need this for relative symlinks
|
---|
29 | while [ -h "$PRG" ] ; do
|
---|
30 | ls=`ls -ld "$PRG"`
|
---|
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
|
---|
32 | if expr "$link" : '/.*' > /dev/null; then
|
---|
33 | PRG="$link"
|
---|
34 | else
|
---|
35 | PRG="`dirname "$PRG"`/$link"
|
---|
36 | fi
|
---|
37 | done
|
---|
38 |
|
---|
39 | # make it fully qualified
|
---|
40 | saveddir=`pwd`
|
---|
41 | MYAPP_HOME=`dirname "$PRG"`/..
|
---|
42 | MYAPP_HOME=`cd "$MYAPP_HOME" && pwd`
|
---|
43 | cd "$saveddir"
|
---|
44 |
|
---|
45 | # Build up the classpath of required jar files.
|
---|
46 | MYAPP_CLASSPATH=$MYAPP_HOME/osmosis.jar:$OSMOSIS_CLASSPATH
|
---|
47 | for FILE in `ls $MYAPP_HOME/lib/default/`; do
|
---|
48 | MYAPP_CLASSPATH=$MYAPP_CLASSPATH:$MYAPP_HOME/lib/default/$FILE
|
---|
49 | done
|
---|
50 |
|
---|
51 | MAINCLASS=org.openstreetmap.osmosis.extract.mysql.v0_6.OsmosisExtractMysql
|
---|
52 | EXEC="$JAVACMD $JAVACMD_OPTIONS -cp $MYAPP_CLASSPATH $MAINCLASS $@"
|
---|
53 |
|
---|
54 | exec $EXEC
|
---|