Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
# DM setup script for Bourne-type shells
# This file is typically sourced in user's .bashrc file
myDir=`dirname $BASH_SOURCE`
currentDir=`pwd` && cd $myDir
if [ ! -z "$DM_ROOT_DIR" -a "$DM_ROOT_DIR" != `pwd` ]; then
echo "WARNING: Resetting DM_ROOT_DIR environment variable (old value: $DM_ROOT_DIR)"
fi
export DM_ROOT_DIR=`pwd`
if [ -z $DM_DATA_DIR ]; then
export DM_DATA_DIR=$DM_ROOT_DIR/../data
if [ -d $DM_DATA_DIR ]; then
cd $DM_DATA_DIR
export DM_DATA_DIR=`pwd`
fi
fi
if [ ! -d $DM_DATA_DIR ]; then
#echo "WARNING: $DM_DATA_DIR directory does not exist. Developers should point DM_DATA_DIR to the desired area."
unset DM_DATA_DIR
fi
if [ -z $DM_VAR_DIR ]; then
export DM_VAR_DIR=$DM_ROOT_DIR/../var
if [ -d $DM_VAR_DIR ]; then
cd $DM_VAR_DIR
export DM_VAR_DIR=`pwd`
fi
fi
# Check support setup
if [ -z $DM_SUPPORT_DIR ]; then
export DM_SUPPORT_DIR=$DM_ROOT_DIR/../support
if [ -d $DM_SUPPORT_DIR ]; then
cd $DM_SUPPORT_DIR
export DM_SUPPORT_DIR=`pwd`
fi
fi
if [ ! -d $DM_SUPPORT_DIR ]; then
echo "ERROR: $DM_SUPPORT_DIR directory does not exist. Developers should point DM_SUPPORT_DIR to the desired area."
return 1
else
export DM_GLASSFISH_DIR=$DM_SUPPORT_DIR/glassfish/$DM_HOST_ARCH
fi
export DM_HOST_ARCH=`uname | tr [A-Z] [a-z]`-`uname -m`
# Add to path only if directory exists.
prependPathIfDirExists() {
_dir=$1
if [ -d ${_dir} ]; then
PATH=${_dir}:$PATH
fi
}
prependPathIfDirExists $DM_SUPPORT_DIR/postgresql/$DM_HOST_ARCH/bin
prependPathIfDirExists $DM_SUPPORT_DIR/java/$DM_HOST_ARCH/bin
prependPathIfDirExists $DM_SUPPORT_DIR/ant/bin
prependPathIfDirExists $DM_ROOT_DIR/bin
PATH=.:$PATH
export PATH
if [ -z $LD_LIBRARY_PATH ]; then
LD_LIBRARY_PATH=.
else
LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
fi
export LD_LIBRARY_PATH
# Setup python path.
# Check if we have local python
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
if [ -z $DM_PYTHON_DIR ]; then
pythonDir=$DM_SUPPORT_DIR/python/$DM_HOST_ARCH
else
pythonDir=$DM_PYTHON_DIR
fi
if [ -d $pythonDir ]; then
cd $pythonDir
pythonDir=`pwd`
export PATH=`pwd`/bin:$PATH
export LD_LIBRARY_PATH=`pwd`/lib:$LD_LIBRARY_PATH
export DM_PYTHON_DIR=$pythonDir
fi
if [ -z $PYTHONPATH ]; then
PYTHONPATH=$DM_ROOT_DIR/lib/python
else
PYTHONPATH=$DM_ROOT_DIR/lib/python:$PYTHONPATH
fi
export PYTHONPATH
# Get back to where we were before invoking the setup script
cd $currentDir
# Print out user environment
echo
echo "Your DM environment is defined as follows:"
echo
env | grep DM_ | grep -v GDM_
echo
echo