-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgtmenv
executable file
·142 lines (122 loc) · 4.33 KB
/
gtmenv
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/bin/bash
# ------------------------------------------------------------------------
# gtmenv - GT.M and PROFILE/Anyware environment script
#
# Description:
# This script will define a users GT.M and PROFILE/Anyware environment for
# the directory referenced by the DIR environment variable. All changes
# needed to this script should be placed in the gtmenv1 script file. The
# gtmenv1 script file is called at the end of this script file.
#
# Input: None
#
# Output: Assigns GT.M and PROFILE/Anyware environment variables
#
# Usage: . gtmenv or . /directory_path/gtmenv
# $ . /ibs-prod/gtmenv
# or
# $ cd /ibs-prod
# $ . gtmenv
#
# Setup: At top assign DIR to equal the directory name
# DIR=/ibs-prod
# or
# DIR=/fms-prod
# ------------------------------------------------------------------------
#Change to the PIP directory
cd `dirname $0`
# Directory to define GT.M and PROFILE/Anyware environment variables.
DIR=$PWD
PROFILE_DIR=${DIR}
DIR_REF=`basename ${DIR}|tr "[a-z]" "[A-Z]"`
eval ${DIR_REF}=${DIR}
export PROFILE_DIR ${DIR_REF}
# Set up the GTM distribution variable
gtm_dist=/opt/yottadb/current
GTM_DIST=${gtm_dist}
export gtm_dist GTM_DIST
# Set up the SCA GTM variables
SCA_GTMO=${DIR}/util/obj
SCA_RTNS=${DIR}/util
export SCA_GTMO SCA_RTNS
# Set up the IBS or FMS directory variables (SCAU variables)
SCAU_DIR=${DIR}
SCAU_GBLS=${DIR}/gbls
SCAU_MRTNS=${DIR}/mrtns
SCAU_CRTNS=${DIR}/crtns
SCAU_SRTNS=${DIR}/srtns
SCAU_PRTNS=${DIR}/prtns
SCAU_ZRTNS=${DIR}/zrtns
SCAU_HELP=${DIR}/help
SCAU_SPOOL=${DIR}/spool
SCAU_LOG_DIR=${DIR}/log
SCAU_REPL_DIR=${DIR}/replication
export SCAU_GBLS SCAU_MRTNS SCAU_CRTNS SCAU_SRTNS SCAU_ZRTNS SCAU_SPOOL
export SCAU_PRTNS SCAU_HELP SCAU_DIR
export SCAU_LOG_DIR SCAU_REPL_DIR
eval SCAU_${DIR_REF}_UBG=${DIR}/gbls/mumps.dat
export SCAU_${DIR_REF}_UBG
# Setup Replication if being used. - Needed for IBS servers
# Set up the GTM specific directory variables
gtmgbldir=${SCAU_GBLS}/pip.gld
export gtmgbldir
# Unset prior to customization in gtmenv1. If not defined in gtmenv1
# will be set to default upon returning
unset gtmroutines
# Unset Packages which is defined later
unset SCAU_PACKAGES
# Set SCA path
#PATH=.:${HOME}:/bin:/bin/posix:/usr/bin:/usr/sbin:/usr/contrib/bin:/usr/local/bin:/etc:/usr/ucb:${gtm_dist}:${BUILD_DIR}/install/usrlocalbin
#export PATH
# Set the file mode creation mask
#umask 117
# Unset gtm_log and gtm_tmp in the event multiple GT.M versions are used.
unset gtm_log
unset gtm_tmp
# Call custom gtmenv file if it exist.
if [ -f ${DIR}/gtmenv1 ] ; then
. ${DIR}/gtmenv1
fi
# Call History Archiving if it exists
if [ -f ${DIR}/archenv ] ; then
. ${DIR}/archenv
fi
# Create search list if SCAU_PACKAGES is defined. If not defined, set to default.
# Use a predefined gtm routines if defined in gtmenv1
if [ "${gtmroutines:-""}" = "" ] ; then
rtn_list="${SCAU_PRTNS} ${SCAU_ZRTNS} ${SCAU_SRTNS}/obj(${SCAU_SRTNS}) ${SCAU_MRTNS}/obj(${SCAU_MRTNS}) ${SCAU_CRTNS}/obj(${SCAU_CRTNS}) ${SCA_GTMO}(${SCA_RTNS}) ${gtm_dist}/utf8/libyottadbutil.so"
else
rtn_list=${gtmroutines}
fi
if [ "${SCAU_PACKAGES:-""}" = "" ] ; then
gtmroutines=${rtn_list}
else
# Build package search list
piece=$((1))
pak_list=""
package=`echo ${SCAU_PACKAGES}: | cut -f${piece} -d':'` ; piece=$((${piece}+1))
while [ "${package}" != "" ] ; do
rtn_package=${SCAU_CRTNS}/${package}
obj_package=${rtn_package}/obj
if [ -d ${rtn_package} ] ; then
if [ ! -d ${obj_package} ] ; then
rtn_list_package="${rtn_package}"
else
rtn_list_package="${obj_package}(${rtn_package})"
fi
if [ "`echo ${rtn_list} | grep \" ${rtn_list_package} \"`" = "" ] ; then
pak_list="${pak_list} ${rtn_list_package}"
fi
else
echo "Invalid Package routine directory for ${package}"
fi
package=`echo ${SCAU_PACKAGES}: | cut -f${piece} -d':'` ; piece=$((${piece}+1))
done
pak_list="${pak_list} ${SCAU_CRTNS}/obj(${SCAU_CRTNS})"
org="${SCAU_CRTNS}/obj(${SCAU_CRTNS})"
gtmroutines="`echo ${rtn_list} | sed \"s/$(echo ${org} | sed 's/\//\\\\\//g')/$(echo ${pak_list} | sed 's/\//\\\\\//g')/g\"`"
#echo ${rtn_list} | sed "s/$(echo ${org} | sed 's/\//\\\//g')/$(echo ${pak_list} | sed 's/\//\\\//g')/g"
fi
unset org obj_package package pak_list piece
unset rtn_list rtn_list_package rtn_package
export gtmroutines