-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathojdbc-get.sh
executable file
·136 lines (121 loc) · 3.45 KB
/
ojdbc-get.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
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
#!/usr/bin/env mksh
set -vex
print 'By downloading the Oracle Database JDBC Driver you are
accepting the OTN License Agreement.
This is a link to a copy of the OTN License Agreement:
<http://www.oracle.com/technetwork/licenses/distribution-license-152002.html>'
function mksettings_xml
{
if [[ ! -d /root/.m2 ]]; then
mkdir /root/.m2
fi
cat > /root/.m2/settings-security.xml <<-EOF
<settingsSecurity>
<master>${MVN_EPASS}</master>
</settingsSecurity>
EOF
eval typeset -r MVN_EPASS="${ mvn -emp ${MVN_PASS}; }"
eval typeset -r ORACLEMVN_EPASS="${ mvn -ep ${ORACLEMVN_PASS}; }"
cat > /root/.m2/settings.xml <<-EOF
<settings>
<servers>
<server>
<id>maven.oracle.com </id>
<username>${ORACLEMVN_USER}</username>
<password>${ORACLEMVN_EPASS}</password>
<configuration>
<basicAuthScope>
<host>ANY </host>
<port>ANY </port>
<realm>OAM 11g </realm>
</basicAuthScope>
<httpConfiguration>
<all>
<params>
<property>
<name>http.protocol.allow-circular-redirects </name>
<value>%b,true </value>
</property>
</params>
</all>
</httpConfiguration>
</configuration>
</server>
</servers>
</settings>
EOF
}
function updatepom_xml
{
ORACLE_CFG1="$(cat <<-EOF
<repository>
<id>maven.oracle.com</id>
<name>oracle-maven-repo</name>
<url>https://maven.oracle.com</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
</repository>
EOF
)"
ORACLE_CFG5="$(cat <<-EOF
<pluginRepositories>
<pluginRepository>
<id>maven.oracle.com</id>
<name>oracle-maven-repo</name>
<url>https://maven.oracle.com</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
EOF
)"
ORACLE_CFG2="$(cat <<-EOF
<dependency>
<groupId>com.oracle.jdbc</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
</dependency>
<dependency>
<groupId>com.oracle.jdbc</groupId>
<artifactId>orai18n</artifactId>
<version>12.1.0.2</version>
</dependency>
<dependency>
<groupId>com.oracle.jdbc</groupId>
<artifactId>ucp</artifactId>
<version>12.1.0.2</version>
</dependency>
EOF
)"
ORACLE_CFG3="$(cat <<-EOF
<classpathentry kind="lib" path="lib/ojdbc7-12.1.0.2.jar"/>
EOF
)"
ORACLE_CFG4="$(cat <<-EOF
<dialect>config/dialects/tpcc_dialects.xml</dialect>
EOF
)"
awk -v cfg="${ORACLE_CFG1}" "{ gsub(/<!--ORACLE_CFG1-->/,cfg); print}" /oltpbench/pom.xml > /tmp/mod.pom.xml
awk -v cfg="${ORACLE_CFG2}" "{ gsub(/<!--ORACLE_CFG2-->/,cfg); print}" /tmp/mod.pom.xml > /tmp/mod.mod.pom.xml
awk -v cfg="${ORACLE_CFG5}" "{ gsub(/<!--ORACLE_CFG5-->/,cfg); print}" /tmp/mod.mod.pom.xml > /oltpbench/pom.xml
awk -v cfg="${ORACLE_CFG3}" "{ gsub(/<!--ORACLE_CFG3-->/,cfg); print}" /oltpbench/.classpath > /oltpbench/mod.classpath
awk -v cfg="${ORACLE_CFG4}" "{ gsub(/<!--ORACLE_CFG4-->/,cfg); print}" /oltpbench/config-templates/benchmarks/tpcc.xml > /tmp/mod.tpcc.xml
mv /oltpbench/mod.classpath /oltpbench/.classpath
mv /tmp/mod.tpcc.xml /oltpbench/config-templates/benchmarks/tpcc.xml
cat /oltpbench/pom.xml
cat /root/.m2/*.xml
}
function main
{
mksettings_xml
updatepom_xml
return $?
}
main
exit "$?"