-
Notifications
You must be signed in to change notification settings - Fork 4
/
funcs.sh
executable file
·63 lines (59 loc) · 1.1 KB
/
funcs.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
50
51
52
53
54
55
56
57
58
59
60
61
62
# ----
# $1 is the properties file
# ----
PROPS=$1
if [ ! -f ${PROPS} ] ; then
echo "${PROPS}: no such file" >&2
exit 1
fi
# ----
# getProp()
#
# Get a config value from the properties file.
# ----
function getProp()
{
grep "^${1}=" ${PROPS} | sed -e "s/^${1}=//"
}
# ----
# getCP()
#
# Determine the CLASSPATH based on the database system.
# ----
function setCP()
{
case "$(getProp db)" in
firebird)
cp="../lib/firebird/*:../lib/*"
;;
oracle)
cp="../lib/oracle/*"
if [ ! -z "${ORACLE_HOME}" -a -d ${ORACLE_HOME}/lib ] ; then
cp="${cp}:${ORACLE_HOME}/lib/*"
fi
cp="${cp}:../lib/*"
;;
postgres)
cp="../lib/postgres/*:../lib/*"
;;
mo)
cp="./lib/*"
;;
esac
myCP=".:${cp}"
export myCP
}
# ----
# Make sure that the properties file does have db= and the value
# is a database, we support.
# ----
case "$(getProp db)" in
firebird|oracle|postgres|mo)
;;
"") echo "ERROR: missing db= config option in ${PROPS}" >&2
exit 1
;;
*) echo "ERROR: unsupported database type 'db=$(getProp db)' in ${PROPS}" >&2
exit 1
;;
esac