Last change
on this file since 37644 was 36422, checked in by davidb, 21 months ago |
Only print out if dir
|
-
Property svn:executable
set to
*
|
File size:
1.4 KB
|
Rev | Line | |
---|
[36420] | 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 |
|
---|
| 6 | testSource() {
|
---|
| 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
|
---|
| 38 | testSource
|
---|
| 39 | if [ "$?" = "1" ] ; then
|
---|
| 40 | return
|
---|
| 41 | fi
|
---|
| 42 |
|
---|
| 43 |
|
---|
| 44 | if test -e ext-cli ; then
|
---|
| 45 | for gsdl_ext in ext-cli/* ; do
|
---|
| 46 | if test -d $gsdl_ext ; then
|
---|
[36422] | 47 | echo $gsdl_ext
|
---|
[36420] | 48 | cd $gsdl_ext > /dev/null
|
---|
| 49 | if test -e SETUP.sh ; then
|
---|
| 50 | . ./SETUP.sh
|
---|
| 51 | fi
|
---|
| 52 | cd ../..
|
---|
| 53 | fi
|
---|
| 54 | done
|
---|
| 55 | fi
|
---|
| 56 |
|
---|
| 57 |
|
---|
| 58 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.