-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·75 lines (59 loc) · 1.95 KB
/
build.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
#!/usr/bin/env bash
##############################################################################
#
# This script is for building the vdbench container.
# it used the 'podman' for the build and accept the build TAG
# from the user.
# without the tag the script will stop and exit with error.
# the script must be run from the top directory of the vdbench.
#
# the repository that it will create is on quay, but this can be changed.
#
# Author : Avi Liani <[email protected]>
# Creation date : Jan,11,2020
#
##############################################################################
Tag=$1
# This is the repository that the container will push into.
# This need to be change if you want to use a different repository.
#Repo="docker-registry.upshift.redhat.com/vdbench/vdbench"
Repo="quay.io/avili/vdbench"
CMD_TOOL='podman' # if you want this can be replace with : 'docker'
zip_file="vdbench50407.zip"
if [[ ! -f ${zip_file} ]] ; then
echo "The source file from Oracle (${zip_file}) is not present."
echo "Pleas download it and rerun again."
exit 1
fi
if [[ ${Tag} == "" ]] ; then
echo "Error: you mast give the tag name for the build !"
exit 1
fi
echo "Creating Bin Directory : bin"
mkdir bin
if [[ $? -ne 0 ]] ; then
echo "can not create directory !"
exit 1
fi
echo "Moving the zip file (${zip_file}) to bin directory"
mv ${zip_file} bin/
cd bin
echo "Unzip the zip file"
unzip -q ${zip_file}
echo "Delete unnecessary files"
rm -rf aix windows hp mac sol* example* *.txt *.bat *.pdf
rm -rf linux/config.sh linux/linux32.so linux/sparc64.so
echo "Return zip file to parent directory"
mv vdbench50407.zip ../
cd classes/Vdb
echo "Downloading needed class file"
curl -Os https://community.oracle.com/servlet/JiveServlet/downloadBody/1025084-102-1-177296/CollectSlaveStats.class
if [[ $? -ne 0 ]] ; then
echo "Can not retrieve class file"
exit 1
fi
cd ../../../
echo "Build the container image"
${CMD_TOOL} build -t ${Repo}:${Tag} .
echo "Cleanup....."
rm -rf bin