/
bootslap.sh
executable file
·98 lines (81 loc) · 3.59 KB
/
bootslap.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
#!/bin/bash
##############################################################
# Script to bootstrap dependencies for the bootslap project. #
##############################################################
# Guess default repo path unless $BOOTSLAP_REPO is present.
DEFAULT_REPO=https://github.com/${USER}/bootslap.git
REPO=${BOOTSLAP_REPO:-$DEFAULT_REPO}
DEST=~/src/bootslap
##############################################################
echo -ne "\x1b[37m"
cat <<'EOF'
_ / |
/ \ | | /\
\ \| |/ /
\ Y | /___
__ __ __ .-.) '. `__/
/ /_ ____ ____ / /______/ /___ _____ (.-. / /
/ __ \/ __ \/ __ \/ __/ ___/ / __ `/ __ \ | ' |
/ /_/ / /_/ / /_/ / /_(__ ) / /_/ / /_/ / |___|
/_.___/\____/\____/\__/____/_/\__,_/ .___/ [_____]
/_/ | |
EOF
echo -ne "\x1b[0m"
echo "
Hello! I'm going to set up this workstation for you. It might take some time,
but I guarantee it will be quicker than doing it yourself.
As a reminder, essentially all this script does is:
1. Installs macOS Command Line Developer Tools (if needed).
2. Installs Homebrew.
3. Uses Homebrew to install Ansible.
4. Clones the bootslap repository.
5. Runs the default playbooks (which do all the real work).
"
read -n1 -p $'\e[0;1m👻 Party Ghost sez: "SooOOoOo... R u rdy 2 party"? \e[2m[y/N] ' yn
if [[ $yn != [Yy] ]]; then
printf "\nSo long sucker.\n"; exit;
fi
printf "\n\e[0m
🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉
ALRIGHT, LET'S DO THIS!
🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉
"
echo "Hey, my main squeeze Homebrew is probably going to ask you for your sudo password
so they can mess with some stuff. Don't worry about it, they're cool."
#
# Install Mac Dev Tools
#
# DEPRECATED: handled by homebrew installer script now!
#
#
# Install homebrew
#
printf "\n🍺🍺🍺🍺🍺🍺🍺🍺🍺🍺🍺🍺🍺 INSTALLING HOMEBREW 🍺🍺🍺🍺🍺🍺🍺🍺🍺🍺🍺🍺🍺\n"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
#
# Install ansible via homebrew
#
printf "\n🍻🍻🍻🍻🍻🍻🍻🍻🍻🍻🍻🍻🍻 INSTALLING ANSIBLE 🍻🍻🍻🍻🍻🍻🍻🍻🍻🍻🍻🍻🍻\n"
brew install git ansible
#
# Clone my repo to somewhere useful, and chdir to it
#
printf "\n🍕🍕🍕🍕🍕🍕🍕🍕🍕🍕🍕🍕🍕 CLONING PLAYBOOKS 🍕🍕🍕🍕🍕🍕🍕🍕🍕🍕🍕🍕🍕\n"
if [ ! -d $DEST ]; then
mkdir -p "$(dirname $DEST)"
git clone "$REPO" "$DEST"
else
echo "Already cloned, updating to latest."
(cd $DEST && git pull)
fi
#
# Run all relevant playbooks
#
printf "\n💰💰💰💰💰💰💰💰💰💰💰💰💰 RUNNING PLAYBOOKS 💰💰💰💰💰💰💰💰💰💰💰💰💰\n"
if [ "$TRAVIS" == "true" ]; then
# if we are running on travis-ci, run the tests in check mode instead
echo "Detected run on travis-ci, running playbooks in check mode for dry-run."
(cd $DEST && ansible-playbook --check install.yml shell.yml configure.yml)
else
(cd $DEST && ansible-playbook -K install.yml shell.yml configure.yml)
fi