-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·63 lines (53 loc) · 1.25 KB
/
bootstrap.sh
File metadata and controls
executable file
·63 lines (53 loc) · 1.25 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
#!/bin/bash
PROVISION_DIR=/tmp/provision
GITHUB_REPO=https://github.com/bennettandrews/osx-provision.git
fancy_echo() {
echo $1
}
info() {
fancy_echo " INFO | $1"
}
warn() {
fancy_echo " WARN | $1"
}
function pause(){
printf "\n%b\n" "$*"
read -p ""
}
xcode_cli_tools() {
xcode_status=$(xcode-select --print 2> /dev/null)
if [ $? -gt 0 ]; then
info "Installing command line tools"
else
warn "Command line tools are already installed"
return
fi
xcode-select --install 2> /dev/null
pause "Press return once the command line tools are installed."
}
ansible_deps() {
info "Installing python dependencies"
if [ ! -x /usr/local/bin/pip ]; then
sudo easy_install -q pip
sudo pip -q install virtualenv
fi
mkdir -p $PROVISION_DIR
virtualenv $PROVISION_DIR
/tmp/provision/bin/pip -q install ansible
}
ansible() {
info "Running Ansible"
$PROVISION_DIR/bin/ansible-playbook $PROVISION_DIR/repo/playbook.yml -e install_user=`whoami` -i $PROVISION_DIR/repo/inventory --ask-sudo-pass
}
clone_repo() {
git clone -q $GITHUB_REPO $PROVISION_DIR/repo
}
main() {
#xcode_cli_tools
clone_repo
ansible_deps
ansible
}
if [ $# -eq 0 ]; then
main
fi