This repository has been archived by the owner on Feb 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
init.sh
executable file
·132 lines (117 loc) · 5.41 KB
/
init.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
#!/bin/sh
DEMO="OpenShift Install Demo"
AUTHORS="Andrew Block, Eric D. Schabell"
PROJECT="[email protected]:eschabell/openshift-install-demo.git"
ORIGIN_HOME=./target
SRC_DIR=./installs
SUPPORT_DIR=./support
VAGRANT_FILE=Vagrantfile
OC_LINUX=openshift-origin-client-tools-v1.1.1-e1d9873-linux-64bit.tar.gz
OC_MAC=openshift-origin-client-tools-v1.1.1-e1d9873-mac.zip
VERSION=1.1.1
# wipe screen.
clear
echo
echo "###############################################################"
echo "## ##"
echo "## Setting up the ${DEMO} ##"
echo "## ##"
echo "## ##"
echo "## ### #### ##### # # #### # # ##### ##### ##### ##"
echo "## # # # # # ## # # # # # # # ##"
echo "## # # #### ### # # # ### ##### # ### # ##"
echo "## # # # # # ## # # # # # # ##"
echo "## ### # #### # # #### # # ##### # # ##"
echo "## ##"
echo "## ##"
echo "## brought to you by, ${AUTHORS} ##"
echo "## ##"
echo "## ${PROJECT} ##"
echo "## ##"
echo "###############################################################"
echo
command -v vagrant -v >/dev/null 2>&1 || { echo >&2 "Vagrant is required but not installed yet... download here: https://www.vagrantup.com/downloads.html"; exit 1; }
echo "Vagrant is installed..."
echo
command -v VirtualBox -h >/dev/null 2>&1 || { echo >&2 "VirtualBox is required but not installed yet... downlaod here: https://www.virtualbox.org/wiki/Downloads"; exit 1; }
echo "VirtualBox is installed..."
echo
# Remove the old insallation, if it exists.
if [ -x $ORIGIN_HOME ]; then
echo " - removing existing installation..."
echo
rm -rf $ORIGIN_HOME
fi
# Run installation.
echo "Setting up installation now..."
echo
mkdir -p $ORIGIN_HOME/openshift
echo "Setup vagrant file..."
echo
cp $SUPPORT_DIR/$VAGRANT_FILE $ORIGIN_HOME/openshift
echo "Setting up OpenShift commandline tools..."
mkdir -p $ORIGIN_HOME/openshift/bin
if [[ `uname` == 'Darwin' ]]; then
unzip -q $SUPPORT_DIR/$OC_MAC -d $ORIGIN_HOME/openshift/bin
else
tar -zvf $SUPPORT_DIR/$OC_LINUX -d $ORIGIN_HOME/openshift/bin
fi
echo
echo "Downloading and installing OpenShift via Vagrant...."
echo
echo " ...be patient, it's a big file!"
echo
cd $ORIGIN_HOME/openshift
vagrant up --provider=virtualbox
if [ $? -ne 0 ]; then
echo
echo "Detected a previous installation of this demo..."
echo
echo "Cleaning out previous Vagrant entry (you have to manually verify this step):"
echo
vagrant destroy $(vagrant 'global-status' | grep 'openshift-install' | cut -d ' ' -f 1)
echo
echo "Cleaining out previous VirtualBox entry:"
echo
vboxmanage controlvm 'origin-1.1.1' poweroff
vboxmanage unregistervm 'origin-1.1.1' --delete
echo
echo "Cleanup done, re-trying the openshift-install-demo installation."
echo
vagrant up --provider=virtualbox
fi
echo
echo "To use installed CLI tooling add the following to your path for access:"
echo
echo " $ export PATH=\$PATH:`pwd`/bin"
echo
echo "==================================================================="
echo "= ="
echo "= After adding to path, you can use 'oc' from CLI to login: ="
echo "= ="
echo "= $ oc login https://10.2.2.2 ="
echo "= ="
echo "= Authentication required for https://10.2.2.2:8443 (openshift) ="
echo "= Username: {insert-any-login-here} ="
echo "= ="
echo "= Login successful. ="
echo "= ="
echo "= You don't have any projects. You can try to create a new ="
echo "= project, by running: ="
echo "= ="
echo "= $ oc new-project ="
echo "= ="
echo "==================================================================="
echo
echo "==================================================================="
echo "= ="
echo "= Now login via browser to OpenShift: https://10.2.2.2:8443 ="
echo "= ="
echo "= To stop this demo use the following command: ="
echo "= ="
echo "= $ vagrant halt ="
echo "= ="
echo "= $DEMO Setup Complete. ="
echo "= ="
echo "==================================================================="
echo