-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbootstrap.sh
executable file
·154 lines (124 loc) · 3.93 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
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/usr/bin/env bash
set -e
SCRIPT_PATH="$(
cd "$(dirname "${BASH_SOURCE[0]}")"
pwd -P
)"
function run_module() {
local -r module_name="$1"
local -r mutex_path="$HOME/.macos-bootstrap/.macosbs-mutex--$module_name"
# Check if a mutex for a module exists; don't run the same module again
if [ -f "$mutex_path" ]; then
echo "The module $module_name has already been run and won't be run again."
return
fi
# Print the module banner
echo "--------------------------------------------------------------------------------"
echo " Module: $module_name"
echo ""
echo " This module will:"
bash -c ". $SCRIPT_PATH/modules/$module_name/install.sh && describe_actions"
echo ""
echo "--------------------------------------------------------------------------------"
echo "Do you want to run this module? (y/N)"
read -r install
if [ "$install" == "y" ]; then
# Run the module with the utilities sourced
bash -c ". $SCRIPT_PATH/modules/@utils/utils.sh && . $SCRIPT_PATH/modules/$module_name/install.sh && install"
else
echo "Opted out of module $module_name"
fi
# Write a mutex file to prevent duplicate runs of the same module
touch "$mutex_path"
echo "Finished module $module_name."
echo ""
}
function load_environment() {
if [ -f .macos-bootstrap.env ]; then
echo "Environment file exists; loading it..."
env .macos-bootstrap.env
echo "Environment file loaded to current shell."
fi
}
function init_dotfiles() {
echo "Do you want to use iCloud Drive to sync your dotfiles? (y/N)"
echo ""
read -r dotfile_sync
if [ "$dotfile_sync" == "y" ]; then
echo "Using iCloud Drive for dotfile synchronization."
export DOTFILES_BASE_PATH="$HOME/Library/Mobile Documents/com~apple~CloudDocs"
else
echo "Dotfile synchronization disabled (using local default paths)."
export DOTFILES_BASE_PATH="$HOME"
fi
}
function bootstrap() {
echo "Running bootstrap sequence..."
# Load environment file if it exists
load_environment
# Initialize dotfiles from sync source
init_dotfiles
# Run installer modules in pre-defined order
# We're installing homebrew first because we'll use it to install GNU versions of commands that we'll use in other modules.
run_module "homebrew"
run_module "shell-utils"
# We're installing bash to allow subsequent modules to use bash 4/5 features.
run_module "bash"
# Install Oh My Zsh and related shell plugins
run_module "zsh"
run_module "zsh-powerline"
run_module "zsh-auto-suggestions"
# Install and configure gnupg
run_module "gnupg"
# Configure syncing of .gitconfig
run_module "git-config"
# Install and configure passwordstore
run_module "pass"
# Configure SSH key and config synchronization
run_module "ssh"
# Install and configure CLI developer tools
run_module "pre-commit"
run_module "git-crypt"
run_module "packer"
run_module "k8s"
# Install frameworks and runtimes
run_module "python"
run_module "nodejs"
run_module "go"
run_module "terraform"
# Install cloud service provider SDKs and CLI tools
run_module "aws-cli"
run_module "az"
run_module "gcloud"
run_module "gh"
# Install applications
run_module "mas"
run_module "raycast"
run_module "1password"
run_module "chrome"
run_module "bartender"
run_module "magnet"
run_module "docker"
run_module "iterm"
run_module "synalyze-it-pro"
run_module "kaleidoscope"
run_module "keybase"
run_module "vscode"
run_module "xcode"
run_module "menubar-clock"
run_module "integrity-pro"
run_module "postman"
run_module "slack"
run_module "microsoft-remote-desktop"
# Install other utilities
run_module "displayplacer"
# Configure the macOS settings
run_module "macos-dock-clear"
run_module "macos-dock-autohide"
run_module "macos-disable-natural-scrolling"
run_module "macos-show-hidden-files"
# Remove bloatware
run_module "macos-remove-builtin-apps"
echo "Completed bootstrap sequence."
}
bootstrap "$@"