-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_openshift
executable file
·83 lines (69 loc) · 1.91 KB
/
build_openshift
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
#!/bin/bash
# couchdb_setup by Robert Starmer is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
set -o errexit
usage() {
cat <<EOF
usage: $0 options
OPTIONS:
-h Show this message
-p http proxy i.e. -p http://username:password@host:port/
EOF
}
function run_cmd () {
if [ -z "$PROXY" ]; then
sudo $*
else
sudo env http_proxy=$PROXY $*
fi
}
if [ -n "$http_proxy" ]; then
if [ -z "$https_proxy" ]; then
echo "Please set https_proxy env variable."
exit 1
fi
PROXY=$http_proxy
fi
while getopts "h:p:" OPTION
do
case $OPTION in
h)
usage
exit 1
;;
p)
PROXY=$OPTARG
export http_proxy=$PROXY
export https_proxy=$PROXY
esac
done
echo -e "\n\nUpdate yum repository...\n\n"
if ! run_cmd yum -y update; then
echo "Can't update yum repository"
exit 1
fi
echo "Installing prerequisite apps: git, rake, npt..."
if ! run_cmd yum -y install git rubygem-rake ntp; then
echo "Can't install prerequisites!..."
exit 1
fi
echo "Cloning openshift crankcase repository from github.com..."
if [ -d ~/crankcase ] ; then
echo -e "Looks like perhaps you ran this script before? We'll try to update your crankcase directory, just in case..."
if ! run_cmd git --git-dir=$HOME/crankcase/.git pull ; then
echo "That did not work. Perhaps rename your crankcase directory, and try again?"
exit 1
fi
fi
if [ ! -d ~/crankcase ] ; then
if ! run_cmd git clone https://github.com/openshift/crankcase.git ~/crankcase ; then
echo "Can't run git clone!"
exit 1
fi
fi
echo "Running build setup..."
if ! (cd ~/crankcase/build; rake build_setup) ;then
echo "Can't run rake!!!"
exit 1
fi
echo -e "\n\nSUCCESS!!!!\n\nNow would be a good time to create a snapshot of this instance, so that you don't have to go through all of that again. You'll stil need to build the broker and nodes, but you're almost there."
exit 0