-
Notifications
You must be signed in to change notification settings - Fork 1
/
add-to-env.sh
executable file
·49 lines (44 loc) · 1.87 KB
/
add-to-env.sh
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
43
44
45
46
47
48
49
#!/bin/bash
# source this script from your bash or sh shell to add this eco_tools
# directory to your PATH.
# You'll need to do this from your shell to do development of these
# scripts, or to use the module conversion and migration tools it provides.
#
# NOTE: Don't run this in your shell startup if you prefer some other python installation.
#
if [ ! -z "`echo $0 | fgrep add-to-env.sh`" ]; then
echo "Usage: source path/to/eco_tools/add-to-env.sh"
exit 1
fi
# Make sure we have a canonical path to eco_tools
this_script=`readlink -f ${BASH_SOURCE[0]}`
eco_tools_dir=`readlink -f $(dirname $this_script)`
# Make sure we have PSPKG_ROOT and SETUP_SITE_TOP
if [ -z "$PSPKG_ROOT" -o -z "$SETUP_SITE_TOP" ]; then
if [ -f /usr/local/controls/config/common_dirs.sh ]; then
source /usr/local/controls/config/common_dirs.sh
elif [ -f /reg/g/pcds/pyps/config/common_dirs.sh ]; then
source /reg/g/pcds/pyps/config/common_dirs.sh
elif [ -f /afs/slac/g/lcls/epics/config/common_dirs.sh ]; then
source /afs/slac/g/lcls/epics/config/common_dirs.sh
elif [ -f /afs/slac/g/pcds/config/common_dirs.sh ]; then
source /afs/slac/g/pcds/config/common_dirs.sh
fi
fi
# Add the git-utils-0.3.0 pkg_mgr release to front of env paths
# for a python installation supporting python/2.7.5, GitPython/2.0.8,
# gitdb/0.6.4, and cvs2svn/2.4.0 along w/ ipython
export PSPKG_RELEASE=git-utils-0.3.0
source $PSPKG_ROOT/etc/add_env_pkg.sh $PSPKG_RELEASE
# Make sure we have a pathmunge function defined
if [ -z "`declare -f pathmunge`" ]; then
if [ -f $SETUP_SITE_TOP/pathmunge.sh ]; then
source $SETUP_SITE_TOP/pathmunge.sh
elif [ -f /afs/slac/g/pcds/setup/pathmunge.sh ]; then
source /afs/slac/g/pcds/setup/pathmunge.sh
elif [ -f /reg/g/pcds/setup/pathmunge.sh ]; then
source /reg/g/pcds/setup/pathmunge.sh
fi
fi
# Add this eco_tools folder to the front of PATH
pathmunge $eco_tools_dir