-
Notifications
You must be signed in to change notification settings - Fork 2
/
bootstrap.sh
executable file
·53 lines (35 loc) · 1.01 KB
/
bootstrap.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
#!/usr/bin/env bash
set -e
# shellcheck disable=SC2292
if [ -z "${BASH_VERSION:-}" ]
then
echo "Bash is required to interpret this script."
exit 1
fi
OS_TARGET=""
macos_preinstall() {
OS_TARGET="macos"
# installs homebrew
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# installs required packages
brew reinstall ansible git wget python3
}
get_playbook() {
# downloads last release
local LAST_TAG
LAST_TAG="$(git ls-remote --tags https://github.com/caian-org/workstation | awk -F '/' '{print $3}' | tail -n 1)"
cd /tmp
wget "https://github.com/caian-org/workstation/archive/${LAST_TAG}.tar.gz"
# extracts the release tarball
tar xzf "${LAST_TAG}.tar.gz"
cd workstation-*
}
case "$OSTYPE" in
"darwin"*) macos_preinstall ;;
*)
printf "unsupported platform %s" "$OSTYPE"
exit 1
;;
esac
if [ -z "${SKIP_PLAYBOOK_DOWNLOAD:-}" ]; then get_playbook; fi
AP_EXTRA="$AP_EXTRA" make $OS_TARGET