aboutsummaryrefslogtreecommitdiff
path: root/build/oracle/configure
blob: a4ff0d99b96bb79e6489b61fe648ac88f47012c8 (plain)
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
#! /usr/bin/env bash

# file      : build/oracle/configure
# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
# license   : GNU GPL v2; see accompanying LICENSE file

#
# dcf_root - dynamic configuration root
#

$echo
$echo "Please enter the Oracle client program path."
$echo

driver=`read_path --command sqlplus`

$echo
$echo "Please enter the Oracle database user."
$echo

user=`read_value "odb_test"`

$echo
$echo "Please enter the Oracle database password."
$echo

# If the user is odb_test then default to odb_test as a password since
# it is unlikely there is the odb_test user with external authentication.
#
if [ "$user" = "odb_test" ]; then
  def_passwd=odb_test
else
  def_passwd=
fi

passwd=`read_value "$def_passwd"`

$echo
$echo "Please enter the Oracle listener host (localhost if left empty)."
$echo

host=`read_value ""`

$echo
$echo "Please enter the Oracle listener port (default port if left empty)."
$echo

port=`read_value ""`

$echo
$echo "Please enter the Oracle service to use (default service if left"
$echo "empty). Note that the database associated with user $user on this"
$echo "service WILL BE MODIFIED."
$echo

service=`read_value ""`

opt=$dcf_root/db.options
drv=$dcf_root/db-driver

if [ -n "$user" ]; then
echo "--user '$user'"        >$opt
fi

if [ -n "$passwd" ]; then
echo "--password '$passwd'" >>$opt
fi

if [ -n "$service" ]; then
echo "--service '$service'" >>$opt
fi

if [ -n "$host" ]; then
echo "--host '$host'"       >>$opt
fi

if [ -n "$port" ]; then
echo "--port '$port'"       >>$opt
fi

echo "#!/bin/sh"                                                >$drv

dir=`dirname $driver`
if [ "$dir" != "." ]; then
  echo                                                         >>$drv
  echo 'LD_LIBRARY_PATH="'$dir':$LD_LIBRARY_PATH"'             >>$drv
  echo "export LD_LIBRARY_PATH"                                >>$drv
  echo                                                         >>$drv
  echo 'if [ -z "$SQLPATH" ]; then'                            >>$drv
  echo '  SQLPATH="'$dir'"'                                    >>$drv
  echo "  export SQLPATH"                                      >>$drv
  echo "fi"                                                    >>$drv
  echo                                                         >>$drv
fi

echo "opt=\`cat $opt\`"                                        >>$drv
echo "eval $scf_root/oracle/oracle --driver $driver \$opt \$*" >>$drv
chmod 755 $drv