Changeset 30252 for gs2-extensions


Ignore:
Timestamp:
2015-09-21T10:21:02+12:00 (9 years ago)
Author:
jmt12
Message:

Adding support for the extension living in Greenstone3, and make script more robust/secure against things like spaces in filepaths

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs2-extensions/tdb/trunk/setup.bash

    r30185 r30252  
    11
    2 extdesc="TDB flavoured editing"
     2extdesc="TDB Database support"
    33
    44full_setup=`pwd`/${BASH_SOURCE}
    5 fulldir=${full_setup%/*}
    6 fulldir=${fulldir%/.}
     5fulldir="${full_setup%/*}"
     6fulldir="${fulldir%/.}"
    77
    8 if [ "x$GSDLHOME" = "x" ] ; then
    9   if [ -e ../../setup.bash ] ; then
    10     export gsopt_noexts=1 && pushd ../.. && source setup.bash && popd
    11     export gsopt_noexts=
    12   elif [ -e ../../gs3-setup.sh ] ; then
    13     export gsopt_noexts=1 && pushd ../.. && source gs3-setup.sh && popd
    14     export gsopt_noexts=
    15   fi
     8GSDLVER=0
    169
     10# Test for one of the homes, otherwise we need to source a top-level setup
     11if [ "${GSDL3HOME}x" != "x" ] ; then
     12    GSDLVER=3
     13fi
     14if [ "${GSDLHOME}x" != "x" ] ; then
     15    GSDLVER=2
     16fi
     17
     18if [ "$GSDLVER" == "0" ] ; then
     19    export gsopt_noexts=1
     20    CWD=`pwd`
     21    cd ../..
     22    if [ -f "./gs3-setup.sh" ] ; then
     23    source ./gs3-setup.sh
     24    GSDLVER=3
     25    else
     26    source ./setup.bash
     27    GSDLVER=2
     28    fi
     29    cd "${CWD}"
     30    unset gsopt_noexts
    1731fi
    1832
     
    2034
    2135  export TDBEDITOS=`uname -s | tr '[A-Z]' '[a-z]' | sed 's/\([0-9]\+\)\?_.*$//'`
    22   export GEXTTDBEDIT=$fulldir
    23   export GEXTTDBEDIT_INSTALLED=$GEXTTDBEDIT/$GSDLOS
     36  export GEXTTDBEDIT="${fulldir}"
     37  export GEXTTDBEDIT_INSTALLED="${GEXTTDBEDIT}/${GSDLOS}"
    2438
    25   export PATH=$GEXTTDBEDIT_INSTALLED/bin:$fulldir/bin/script:$PATH
     39  export PATH="${GEXTTDBEDIT_INSTALLED}/bin:${fulldir}/bin/script:${PATH}"
    2640
    2741  if [ "x$LD_LIBRARY_PATH" = "x" ] ; then
    28     export LD_LIBRARY_PATH=$GEXTTDBEDIT_INSTALLED/lib
     42    export LD_LIBRARY_PATH="${GEXTTDBEDIT_INSTALLED}/lib"
    2943  else
    30     export LD_LIBRARY_PATH=$GEXTTDBEDIT_INSTALLED/lib:$LD_LIBRARY_PATH
     44    export LD_LIBRARY_PATH="${GEXTTDBEDIT_INSTALLED}/lib:${LD_LIBRARY_PATH}"
    3145  fi
    3246
    33   extdir=${GEXTTDBEDIT##*/}
     47  extdir="${GEXTTDBEDIT##*/}"
    3448
    35   if [ "x$GSDLEXTS" = "x" ] ; then
    36     export GSDLEXTS=$extdir
    37   else
    38     export GSDLEXTS=$GSDLEXTS:$extdir
     49  if [ "${GSDLVER}" = "3" ] ; then
     50      if [ "x${GSDL3EXTS}" = "x" ] ; then
     51      export GSDL3EXTS="${extdir}"
     52      else
     53      export GSDL3EXTS="${GSDL3EXTS}:${extdir}"
     54      fi
     55  else
     56      if [ "x${GSDLEXTS}" = "x" ] ; then
     57      export GSDLEXTS="${extdir}"
     58      else
     59      export GSDLEXTS="${GSDLEXTS}:${extdir}"
     60      fi
    3961  fi
    4062
    41   echo "+Your environment is now setup for $extdesc to Greenstone"
     63
     64
     65  echo "+Your environment is now setup for $extdesc for Greenstone${GSDLVER}"
    4266else
    43   echo "+Your environment is already setup for $extdesc to Greenstone"
     67  echo "+Your environment is already setup for $extdesc for Greenstone${GSDLVER}"
    4468fi
    4569
Note: See TracChangeset for help on using the changeset viewer.