-
Notifications
You must be signed in to change notification settings - Fork 9
/
install
executable file
·115 lines (83 loc) · 3.15 KB
/
install
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
#!/bin/bash
# Purpose:
# - bootstrap machine in order to prepare for ansible playbook run
RELEASE="master"
DOWNLOAD="https://github.com/bmacauley/ansible-playbook-mac-dev/archive/$RELEASE.tar.gz"
set -e
# Download and install Command Line Tools if no developer tools exist
# * previous evaluation didn't work completely, due to gcc binary existing for vanilla os x install
# * gcc output on vanilla osx box:
# * 'xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install.
# * Choose an option in the dialog to download the command line developer tools'
#
# Evaluate 2 conditions
# * ensure dev tools are installed by checking the output of gcc
# * check to see if gcc binary even exists ( original logic )
# if either of the conditions are met, install dev tools
echo '==================================='
echo 'Macbook dev tools installer'
echo '==================================='
echo
echo ' Uses the following Ansible playbook...'
echo 'https://github.com/bmacauley/ansible-playbook-mac-dev'
echo
echo
if [[ $(/usr/bin/gcc 2>&1) =~ "no developer tools were found" ]] || [[ ! -x /usr/bin/gcc ]]; then
echo "Info | Install | xcode"
xcode-select --install
fi
# Download and install Homebrew
if [[ ! -x /usr/local/bin/brew ]]; then
echo "Info | Install | homebrew"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
if [ $(ls /Applications/ | grep iTerm.app) ]; then
echo "Info | Install | iTerm2"
brew cask install iterm2
fi
if [[ ! -x /usr/local/bin/fish ]]; then
echo "Info | Install | Fish"
brew install fish
fi
# Download and install Java
if [[ $(java 2>&1) =~ "No Java runtime present" ]]; then
echo "Info | Install | Java"
brew cask install java
fi
# Download and install Python 3
if [[ ! -x /usr/local/bin/python ]]; then
echo "Info | Install | Python"
brew install python
fi
# Download and install virtualenv
if [[ ! -x /usr/local/bin/virtualenv ]]; then
echo "Info | Install | virtualenv"
pip3 install virtualenv
fi
# Download and install virtualenvwrapper
if [[ ! -x /usr/local/bin/virtualenvwrapper.sh ]]; then
echo "Info | Install | virtualenvwrapper"
pip3 install virtualenvwrapper
fi
# Download and install Ansible into Python installed by Brew
if [[ ! -x /usr/local/bin/ansible ]]; then
echo "Info | Install | Ansible"
pip3 install ansible
fi
# Remove old ansible-playbook-mac-dev playbook
if [[ ! -x /tmp/ansible-playbook-mac-dev.tar.gz ]]; then
echo "Info | Remove | ansible-playbook-mac-dev playbook"
rm -rf /tmp/ansible-playbook-mac-dev*
fi
# Download and run ansible-playbook-mac-dev playbook
echo "Info | Download | ansible-playbook-mac-dev playbook"
cd /tmp
curl -fsSL -o ansible-playbook-mac-dev.tar.gz $DOWNLOAD
tar zxf ansible-playbook-mac-dev*.tar.gz
# Modify the PATH
# This should be subsequently updated in shell settings
export PATH=/usr/local/bin:$PATH
echo "Info | Run | ansible-playbook-mac-dev playbook"
cd /tmp/ansible-playbook-mac-dev-*
ansible-galaxy install -r requirements.yml
ansible-playbook main.yml -i inventory -K