source: main/trunk/greenstone3/gs3-setup-cli.sh

Last change on this file was 37655, checked in by davidb, 13 months ago

Introduction of environment variable to specify where the ext-cli directory is, independent of needing GSDL3SRCHOME set

  • Property svn:executable set to *
File size: 1.5 KB
Line 
1# It is important that the syntax this file is written in is compliant
2# with /bin/sh syntax. By using this 'older' syntax, then this means
3# it will operate with a range of newer default shell terminal windows,
4# such as ash, bash, ksh, and zsh
5
6testSource() {
7
8 if test "$0" != "`echo $0 | sed s/gs3-setup-cli\.sh//`" ; then
9 # if $0 contains "gs3-setup-cli.sh" we've been run... $0 is shellname if sourced.
10 # One exception is zsh has an option to set it temporarily to the script name
11 if test -z "$ZSH_NAME" ; then
12 # we aren't using zsh
13 gsdl_not_sourced=true
14 fi
15 fi
16
17 if test -n "$gsdl_not_sourced" ; then
18 echo " Error: Make sure you source this script, not execute it. Eg:"
19 echo " $ . ./gs3-setup-cli.sh"
20 echo " or"
21 echo " $ source ./gs3-setup-cli.sh"
22 echo " not"
23 echo " $ ./gs3-setup-cli.sh"
24 unset gsdl_not_sourced
25 exit 1
26 fi
27
28 if test ! -f gs3-setup-cli.sh ; then
29 echo "You must source the script from within the Greenstone home directory"
30 return 1
31 fi
32
33 return 0
34}
35
36
37# Note: use return not exit from a sourced script otherwise it kills the shell
38testSource
39if [ "$?" = "1" ] ; then
40 return
41fi
42
43export GSDL3_EXTCLI_HOME="$PWD/ext-cli"
44echo "Set environment variable GSDL3_EXTCLI_HOME:"
45echo " $GSDL3_EXTCLI_HOME"
46
47if test -e ext-cli ; then
48 for gsdl_ext in ext-cli/* ; do
49 if test -d $gsdl_ext ; then
50 echo $gsdl_ext
51 cd $gsdl_ext > /dev/null
52 if test -e SETUP.sh ; then
53 . ./SETUP.sh
54 fi
55 cd ../..
56 fi
57 done
58fi
59
60
61
Note: See TracBrowser for help on using the repository browser.