forked from openshift/openshift-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-local-setup-centos7.sh
More file actions
executable file
·77 lines (55 loc) · 1.28 KB
/
build-local-setup-centos7.sh
File metadata and controls
executable file
·77 lines (55 loc) · 1.28 KB
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
#!/bin/bash -e
RED="$(echo -e '\033[1;31m')"
GREEN="$(echo -e '\033[1;32m')"
BLUE="$(echo -e '\033[1;34m')"
NORM="$(echo -e '\033[0m')"
OS=centos7
function fatal_error() {
ECODE=$?
if [ $ECODE -ne 0 ]; then
echo
echo -n "${RED}ERROR: fatal error on or near line ${1}"
# print the message if given
[ -n "$2" ] && echo -n ": $2"
echo "${NORM}"
echo
fi
}
function box_with_color_message() {
COLOR=$1
shift
STR="$@"
STRLEN=$((${#STR}+2))
# Top of box
echo -n ' '
for i in $(seq $STRLEN); do echo -n '-'; done;
echo
# Middle with colored message
echo "| ${COLOR}${STR}${NORM} |";
# Bottom of box
echo -n ' '
for i in $(seq $STRLEN); do echo -n '-'; done;
echo
}
function build_image() {
OS=$1
shift
IMAGE=$1
shift
echo
echo
box_with_color_message "${BLUE}" "${IMAGE} on ${OS}"
./${IMAGE}/generate-containers.yml
./${IMAGE}/${OS}/build.sh $@
}
# Setup our traps, so that we see errors on exit
trap 'fatal_error ${LINENO}' ERR
# We need to run from the directory where the script is (we use relative paths)
cd $(dirname $0)
sudo echo "Testing sudo works..."
time (
build_image "${OS}" oso-ops-base $@
build_image "${OS}" oso-zaio $@
build_image "${OS}" oso-zagg-web $@
build_image "${OS}" oso-host-monitoring $@
)