-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap_macos.sh
More file actions
101 lines (87 loc) · 2.45 KB
/
bootstrap_macos.sh
File metadata and controls
101 lines (87 loc) · 2.45 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
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
#!/usr/bin/env bash
tput sgr0
RED=$(tput setaf 1)
ORANGE=$(tput setaf 3)
GREEN=$(tput setaf 2)
PURPLE=$(tput setaf 5)
CYAN=$(tput setaf 4)
BLUE=$(tput setaf 6)
WHITE=$(tput setaf 7)
BOLD=$(tput bold)
RESET=$(tput sgr0)
log_info() {
printf "%b[INFO] %b%b\n" "$BLUE" "$1" "$NC"
}
log_success() {
printf "%b[SUCCESS] %b%b\n" "$GREEN" "$1" "$NC"
}
log_warning() {
printf "%b[WARNING] %b%b\n" "$YELLOW" "$1" "$NC"
}
log_error() {
printf "%b[ERROR] %b%b\n" "$RED" "$1" "$NC"
}
B_CODE_DIR="/Users/$USER/code"
B_WORK_CODE_DIR="$B_CODE_DIR/work"
B_PERSONAL_CODE_DIR="$B_CODE_DIR/personal"
B_DOTFILES_DIR="$B_PERSONAL_CODE_DIR/nauticus-playbook"
install_xcode ()
{
if xcode-select --print-path &> /dev/null; then
log_info "Xcode command line tools already installed:\n$(pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | awk '/version:/ {print $2}')"
else
xcode-select --install
log_success "Xcode CLI tools installed"
fi
}
install_brew ()
{
if command -v brew 2>&1 >/dev/null; then
log_info "Brew already installed"
else
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
log_success "Brew installed"
fi
}
make_working_dirs ()
{
if [[ -d $B_WORK_CODE_DIR && -d $B_PERSONAL_CODE_DIR ]]; then
log_info "Working directories already exist:\n$B_WORK_CODE_DIR\n$B_PERSONAL_CODE_DIR"
else
log_info "Creating working directories:\n$B_WORK_CODE_DIR\n$B_PERSONAL_CODE_DIR"
mkdir -p "$B_WORK_CODE_DIR" "$B_PERSONAL_CODE_DIR"
fi
}
clone_dotfiles()
{
if [[ ! -d $B_DOTFILES_DIR ]]; then
log_info "Cloning dotfiles at: $B_DOTFILES_DIR"
# git clone --recurse-submodules https://github.com/Nauticus/nauticus-playbook.git "$B_DOTFILES_DIR"
log_info "Set remote url on the newly cloned dotfiles repository"
# cd "$B_DOTFILES_DIR" &&
# git remote set-url origin git@github.com:Nauticus/nauticus-playbook.git
fi
}
install_brew_packages ()
{
if command -v brew 2>&1 >/dev/null; then
brew install \
git \
zsh &&
brew install --cask \
ghostty
log_success "Brew packages were either installed or updated"
else
log_error "Brew command was not found. No brew packages were installed"
exit 1
fi
}
run ()
{
install_xcode
make_working_dirs
install_brew
install_brew_packages
clone_dotfiles
}
run