scripts/sql-dk.sh
author František Kučera <franta-hg@frantovo.cz>
Sat, 04 Jan 2014 21:21:04 +0100
branchv_0
changeset 133 a1bf1465df89
parent 122 0c284726a77d
child 150 911b2d55bb08
permissions -rwxr-xr-x
Properties: setLastDefaults()
     1 #!/bin/bash
     2 
     3 # include user-defined overrides and customization
     4 if [ -f ~/.sql-dk/environment.sh ]; then # .sql-dk must match with DIR in Constants.java
     5     . ~/.sql-dk/environment.sh
     6 fi
     7 
     8 # link/copy support files for configuration
     9 [ -f ~/.sql-dk/config.xsd ] || ln -s /usr/share/doc/sql-dk/config.xsd ~/.sql-dk/config.xsd
    10 [ -f ~/.sql-dk/config.rnc ] || ln -s /usr/share/doc/sql-dk/config.rnc ~/.sql-dk/config.rnc
    11 [ -f ~/.sql-dk/config.xsl ] || cp /usr/share/doc/sql-dk/config.xsl ~/.sql-dk/config.xsl # might not work in www browser if just symlinked
    12 
    13 
    14 # Standard JDBC drivers
    15 [ -n "$STANDARD_JDBC" ] || STANDARD_JDBC=(
    16 	"/usr/share/java/postgresql-jdbc4.jar"
    17 	"/usr/share/java/mysql.jar"
    18 );
    19 
    20 # Additional JDBC drivers might be specified in CUSTOM_JDBC array
    21 # Plugins (formatters etc.) might be specified in PLUGINS array
    22 
    23 # JAR containing SQL-DK application
    24 [ -n "$JAR" ] || JAR="/usr/share/sql-dk/sql-dk.jar";
    25 
    26 CLASS_PATH="$JAR";
    27 
    28 for e in "${STANDARD_JDBC[@]}" "${CUSTOM_JDBC[@]}" "${PLUGINS[@]}"; do
    29 	CLASS_PATH="$CLASS_PATH:$e";
    30 done
    31 
    32 
    33 MAIN_CLASS="info.globalcode.sql.dk.CLIStarter";
    34 
    35 LOGGER="-Djava.util.logging.config.class=info.globalcode.sql.dk.logging.LoggerInitializer";
    36 [ -n "$LOG_LEVEL" ] && LOGGER_LEVEL="-Dinfo.globalcode.sql.dk.logging.LoggerInitializer.level=$LOG_LEVEL";
    37 
    38 java $LOGGER $LOGGER_LEVEL -cp "$CLASS_PATH" $MAIN_CLASS "$@"