-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathstart.sh
84 lines (77 loc) · 2.57 KB
/
start.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
#!/bin/bash
#
# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#################################################################################
#
# File: start.sh
#
# Description: Start script to check initial files required for starting the
# packer build. At a minimum, the Linux iso and the database zip
# are required before the packer build will start. Everything else
# is optional.
# if needed pass proxy in,
# if needed use the string 'export' to produce an .ova file
# (proxy or export in any order)
#################################################################################
#
# Cleanup old builds and remove previous output if it exists.
#
function cleanup {
rm -rf *.vdi
rm -rf output_last
mv output output_last
}
#
# Check that at aminimum, the Linux iso, and the main database install zip
# are present otherwise, there is no point in continuing
#
function check_required_files {
export varsaccepted=
if test -f OracleLinux-R7-U3-Server-x86_64-dvd.iso
then
export varsaccepted=" -var iso_downloaded=y "
else
if test -f put_files_here/OracleLinux-R7-U3-Server-x86_64-dvd.iso
then
export varsaccepted=" -var iso_downloaded=y "
mv put_files_here/OracleLinux-R7-U3-Server-x86_64-dvd.iso .
touch put_files_here/OracleLinux-R7-U3-Server-x86_64-dvd.iso
fi
fi
if test -f put_files_here/LINUX.X64_*_db_home.zip
then
export varsaccepted=" $varsaccepted -var oracle_database_downloaded=y "
fi
if test "m$2" = "mexport"
then
export varsaccepted=" $varsaccepted -var proxy=$1 -var skip_export=false "
elif test "m$1" = "mexport"
then
export varsaccepted=" $varsaccepted -var proxy=$2 -var skip_export=false "
else
export varsaccepted=" $varsaccepted -var proxy=$1 "
fi
}
#
# start the packer build with a proxy if it is set.
#
function start_packer_build {
packer build $varsaccepted packerConfig.json
}
#Lets go.
cleanup
check_required_files $1 $2
start_packer_build