forked from driesvints/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall-prerequisites
executable file
·90 lines (75 loc) · 2.59 KB
/
install-prerequisites
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
#!/usr/bin/env bash
cd "$(dirname "$0")"
source ./helpers/runtime.sh
source ../bin/helpers/trap_and_trace.sh
if [[ "$(is_macos)" != "true" && "$(is_linux)" != "true" ]]; then
log_error "This script only supports macOS and Linux"
exit 1
fi
log_info "Installing prerequisites"
# Check for Homebrew and install if we don't have it
log_info "Checking for Homebrew"
SOURCE_HOMEBREW_SILENT=true source ./helpers/source_homebrew.sh
if [[ -z $(command -v brew 2>/dev/null) ]]; then
log_info "Installing Homebrew"
/usr/bin/env bash -c "NONINTERACTIVE=1 $(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
log_info "Initializing Homebrew"
source ./helpers/source_homebrew.sh
log_info "Setting up Homebrew taps"
[[ -n "$(brew tap | grep homebrew/bundle)" ]] || brew tap --quiet homebrew/bundle
[[ -n "$(brew tap | grep homebrew/services)" ]] || brew tap --quiet homebrew/services
# Install prerequisite Homebrew formulae
log_info "Installing prerequisite Homebrew formulae"
brew_args="--require-sha --no-quarantine --overwrite"
if is_force_mode; then
brew_args="$brew_args --force"
fi
if is_verbose_mode; then
brew_args="$brew_args --verbose"
else
brew_args="$brew_args --quiet"
fi
log_debug "Checking for coreutils formulae"
if [ -z "$(brew ls coreutils 2>/dev/null)" ]; then
log_info "Installing coreutils formulae"
brew install $brew_args coreutils
fi
log_debug "Checking for git formulae"
if [ -z "$(brew ls git 2>/dev/null)" ]; then
log_info "Installing git formulae"
brew install $brew_args git
fi
log_debug "Checking for gpg-suite formulae"
if [ -z "$(brew ls gpg-suite 2>/dev/null)" ]; then
log_info "Installing gpg-suite formulae"
brew install $brew_args gpg-suite
fi
log_debug "Checking for zsh formulae"
if [ -z "$(brew ls zsh 2>/dev/null)" ]; then
log_info "Installing zsh formulae"
brew install $brew_args zsh
fi
# Check for bats-core
log_debug "Checking for bats-core formulae"
if [ -z "$(brew ls bats-core 2>/dev/null)" ]; then
log_info "Installing bats-core formulae"
brew install $brew_args bats-core
fi
if [[ "$(is_macos)" == "true" ]]; then
log_debug "Checking for mas formulae"
if [ -z "$(brew ls mas 2>/dev/null)" ]; then
log_info "Installing mas formulae"
brew install $brew_args mas
fi
# Install Xcode via mas
# https://github.com/mas-cli/mas
log_info "Installing Xcode via Mac App Store"
mas install 497799835
# Install Xcode Command Line Tools
log_info "Installing Xcode Command Line Tools"
if [[ -z "$(xcode-select --print-path 2>/dev/null)" ]]; then
xcode-select --install
fi
fi
log_success "Prerequisites installed!"