Debian Codegraph @

installer/src/java/org/python/util/install/driver/jython_test.template

raw
1 #!/usr/bin/env bash
2
3 # 3 variables to be set from the caller (unquoted) -> quoted in here:
4 _INSTALL_DIR="{0}"
5 _SCRIPT="{1}"
6 _JAVA_HOME="{2}"
7
8 # save old home env vars:
9 _OLD_JAVA_HOME=$JAVA_HOME
10 _OLD_JYTHON_HOME=$JYTHON_HOME
11 # save current dir
12 _CURDIR=`pwd`
13
14 cd "$_INSTALL_DIR/bin"
15
16 echo "{3}: no home:"
17 export JAVA_HOME=
18 export JYTHON_HOME=
19 ./jython "$_SCRIPT"
20
21 echo "{3}: only JAVA_HOME:"
22 export JAVA_HOME="$_JAVA_HOME"
23 export JYTHON_HOME=
24 ./jython "$_SCRIPT"
25
26 echo "{3}: only JYTHON_HOME:"
27 export JAVA_HOME=
28 export JYTHON_HOME="$_INSTALL_DIR"
29 ./jython "$_SCRIPT"
30
31 echo "{3}: both homes:"
32 export JAVA_HOME="$_JAVA_HOME"
33 export JYTHON_HOME="$_INSTALL_DIR"
34 ./jython "$_SCRIPT"
35
36 cd ..
37
38 echo "{3}: no home, calling in home dir:"
39 export JAVA_HOME=
40 export JYTHON_HOME=
41 ./jython "$_SCRIPT"
42
43 cd ~
44
45 echo "{3}: no home, calling /jython from another working dir:"
46 export JAVA_HOME=
47 export JYTHON_HOME=
48 "$_INSTALL_DIR/jython" "$_SCRIPT"
49
50 echo "{3}: no home, calling /bin/jython from another working dir:"
51 export JAVA_HOME=
52 export JYTHON_HOME=
53 "$_INSTALL_DIR/bin/jython" "$_SCRIPT"
54
55 # cleanup:
56 cd "$_CURDIR"
57 export JAVA_HOME=$_OLD_JAVA_HOME
58 export JYTHON_HOME=$_OLD_JYTHON_HOME