Changeset 19158

Show
Ignore:
Timestamp:
21.04.2009 14:25:36 (10 years ago)
Author:
oranfry
Message:

space-proofed this script

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/gs2-server.sh

    r19040 r19158  
    77 
    88  # remove leading ./ if present 
    9   prog=${0#./} 
     9  prog="${0#./}" 
    1010 
    11   isrelative=${prog%%/*} 
     11  isrelative="${prog%%/*}" 
    1212 
    13   if [ ! -z $isrelative ] ; then 
     13  if [ ! -z "$isrelative" ] ; then 
    1414    # some text is left after stripping 
    1515    # => is relative 
    16     pwd=$PWD 
    17     prog="$pwd/$prog" 
     16    prog="$PWD/$prog" 
    1817  fi 
    1918 
    20   fulldir=${prog%/*} 
     19  fulldir="${prog%/*}" 
    2120 
    2221  # remove trailing /. if present 
    23   eval $1=${fulldir%/.} 
     22  eval "$1=\"${fulldir%/.}\"" 
    2423} 
    2524 
     
    5251# Setup Greenstone2, unless it has already been done 
    5352if [ -z "$GSDLHOME" ]; then  
    54   pushd $gsdl2path > /dev/null 
     53  pushd "$gsdl2path" > /dev/null 
    5554  source setup.bash 
    5655  popd > /dev/null 
     
    7473if [ ! -e "$GSDLHOME/llssite.cfg" ]; then 
    7574    if [ -e "$GSDLHOME/llssite.cfg.in" ]; then 
    76     cp "$GSDLHOME/llssite.cfg.in" "$GSDLHOME/llssite.cfg" 
     75    cp "$GSDLHOME/llssite.cfg.in" "$GSDLHOME/llssite.cfg" 
    7776    else 
    78     echo "Warning: could not find llssite.cfg.in to create llssite.cfg from." 
     77    echo "Warning: could not find llssite.cfg.in to create llssite.cfg from." 
    7978    fi 
    80 fi   
     79fi 
    8180 
    8281# JRE_HOME or JAVA_HOME must be set correctly to run this program 
     
    8584    # In Java code, '...getResourceAsStream("build.properties")' 
    8685    # needs up to be in the right directory when run 
    87     pushd $gsdl2path > /dev/null 
     86    pushd "$gsdl2path" > /dev/null 
    8887 
    8988 
    9089    #CLASSPATH 
    9190    if [ `isinpath "$CLASSPATH" "$GSDLHOME/lib/java"` == "false" ]; then 
    92     CLASSPATH=$GSDLHOME/lib/java:$CLASSPATH 
    93     for JARFILE in $GSDLHOME/lib/java/*.jar; do 
    94         CLASSPATH=$CLASSPATH:$JARFILE 
    95     done 
    96     export CLASSPATH 
     91        CLASSPATH="$GSDLHOME/lib/java:$CLASSPATH" 
     92        for JARFILE in lib/java/*.jar; do 
     93            CLASSPATH="$CLASSPATH:$GSDLHOME/$JARFILE" 
     94        done 
     95        export CLASSPATH 
     96        echo "  - Adjusted CLASSPATH" 
    9797 
    98     echo "  - Adjusted CLASSPATH" 
    9998    else 
    100     echo "  - CLASSPATH already correct" 
     99        echo "  - CLASSPATH already correct" 
    101100    fi 
    102101 
    103     javapath=`search4j -m $java_min_version -e`  
    104     $javapath org.greenstone.server.Server2 $GSDLHOME $serverlang $* 
     102    javapath="`search4j -m $java_min_version -e`" 
     103    "$javapath" org.greenstone.server.Server2 "$GSDLHOME" "$serverlang" $* 
    105104 
    106105    popd > /dev/null