forked from yamaszone/mac
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall
More file actions
executable file
·116 lines (104 loc) · 2.2 KB
/
install
File metadata and controls
executable file
·116 lines (104 loc) · 2.2 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
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
#!/bin/bash
usage(){
printf "Usage:\n"
printf "\t atom\t\t: Install GitHub Atom editor.\n"
printf "\t awscli\t\t: Install AWS CLIGit.\n"
printf "\t brew\t\t: Install Homebrew.\n"
printf "\t docker\t\t: Install Docker and associated toolchain.\n"
printf "\t minikube\t: Install minikube.\n"
printf "\t tree\t\t: Install tree.\n"
printf "\t vagrant\t: Install vagrant.\n"
printf "\t virtualbox\t: Install VirtualBox.\n"
printf "\t watch\t\t: Install watch.\n"
printf "\t xcode\t\t: Install Xcode.\n"
printf "\t help\t\t: Show this help.\n"
}
# param $1 - Command name
# param $2 - Installation command
install_if_doesnt_exists(){
TOOL=$1
CMD=$2
type $TOOL > /dev/null 2>&1
if [[ "$?" == "1" ]]; then
printf "Installing ${TOOL} ...\n"
echo "$CMD" | /bin/bash
else
printf "${TOOL} is already installed.\n"
fi
}
install_atom(){
CMD="brew cask install atom"
install_if_doesnt_exists "atom" "$CMD"
}
install_awscli(){
CMD="brew install awscli"
install_if_doesnt_exists "aws" "$CMD"
}
install_brew(){
command -v brew
if [ "$?" -eq 1 ]; then
printf "Installing brew...\n"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
}
install_docker(){
# See https://stackoverflow.com/questions/40523307/brew-install-docker-does-not-include-docker-engine
CMD="brew cask install docker"
install_if_doesnt_exists "docker" "$CMD"
}
install_minikube(){
CMD="brew cask install minikube"
install_if_doesnt_exists "minikube" "$CMD"
}
install_tree(){
CMD="brew install tree"
install_if_doesnt_exists "tree" "$CMD"
}
install_vagrant(){
CMD="brew cask install vagrant"
install_if_doesnt_exists "vagrant" "$CMD"
}
install_watch(){
CMD="brew install watch"
install_if_doesnt_exists "watch" "$CMD"
}
install_xcode(){
CMD="xcode-select --install"
install_if_doesnt_exists "xcode-select" "$CMD"
}
CMD=$1
case "$CMD" in
atom)
install_atom
;;
awscli)
install_awscli
;;
brew)
install_brew
;;
docker)
install_docker
;;
minikube)
install_minikube
;;
tree)
install_tree
;;
vagrant)
install_vagrant
;;
virtualbox)
./src/bin/virtualbox "${@:2}"
;;
watch)
install_watch
;;
xcode)
install_xcode
;;
* | -h | help)
usage
;;
esac