-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstart.sh
executable file
·51 lines (46 loc) · 1.39 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
#!/bin/bash
# Prints path to directory containing this script
function scriptDirectory {
local self_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "$self_dir"
}
# Bring in constants
source "$(scriptDirectory)/installation/constants.sh"
# Bring in the helper functions
source "$(scriptDirectory)/installation/helperFunctions.sh"
sandboxInstall() {
if cmdExists docker; then
info "Setting up dockerized sandbox environment..."
docker build -t macsetup .
success "Built docker image for sandbox environment."
info "Starting sandbox environment..."
# Need to forward env var. TERM_PROGRAM so we know what terminal program we are running docker in
docker container run --env TERM_PROGRAM --name macsetup --rm -it -h sandbox macsetup /bin/bash -c "./install.sh"
else
fail "Failed to run in Sandbox mode. Docker cli is not installed."
fi
}
function machineInstall() {
info "Using current machine environment..."
./install.sh
}
### Main ###
PS3=' => Choose Execution Environment: '
options=("Sandbox (Docker)" "Current Machine" "Quit")
select opt in "${options[@]}"
do
case $opt in
"Sandbox (Docker)")
sandboxInstall
break
;;
"Current Machine")
machineInstall
break
;;
"Quit")
break
;;
*) warn "Invalid option $REPLY";;
esac
done