-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.sh
215 lines (184 loc) · 7.09 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
#!/bin/bash
dotfiles_path=~/.dotfiles
setup_gpg() {
echo "Setting up GPG..."
[ ! -d ~/.gnupg ] && mkdir ~/.gnupg && echo "Created ~/.gnupg folder."
echo "pinentry-program $(brew --prefix)/bin/pinentry-mac" >>~/.gnupg/gpg-agent.conf
echo 'use-agent' >>~/.gnupg/gpg.conf
echo "no-emit-version" >>~/.gnupg/gpg.conf
echo "default-key 7A5C62926461D990A0575C9EA03490EFF21E32E9" >>~/.gnupg/gpg.conf
echo "Finished setting up GPG."
}
install_xcode_tools() {
command -v xcode-select &>/dev/null && echo "Xcode CLI is already installed. Consider updating it manually..." && return
echo "Xcode CLI is not installed, do you want to install it? (y/n): "
read -r xcode
if [ "$xcode" == "y" ] || [ -z "$xcode" ]; then
xcode-select --install && echo "Xcode CLI installed."
else
echo "Xcode CLI is required for this script to work. Exiting..." && exit 1
fi
}
install_kitty() {
curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin
}
clone_dotfiles_repo() {
echo "Preparing to clone dotfiles repo..."
echo "Enter the path where to clone the repo (default: $dotfiles_path): "
read user_input
if [ -n "$user_input" ]; then
dotfiles_path=$user_input
fi
echo "Cloning dotfiles repo to $dotfiles_path..."
git clone https://github.com/pseudobun/dotfiles.git $dotfiles_path
echo "Finished cloning dotfiles repo."
cd $dotfiles_path
echo "Executing in: $(pwd)"
}
manage_homebrew() {
if ! command -v brew &>/dev/null; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" && echo "Homebrew installed."
else
brew update && brew upgrade && echo "Homebrew updated."
fi
brew bundle --file ./Brewfile && echo "Homebrew packages installed."
}
set_fish_shell() {
[ "$SHELL" == "$(which fish)" ] && echo "Fish shell is already set as the default shell." && return
echo "Do you want to set fish as default shell? (y/n): "
read -r fish
if [[ "$fish" == "y" ]] || [[ -z "$fish" ]]; then
echo "$(which fish)" | sudo tee -a /etc/shells
chsh -s "$(which fish)" && echo "Fish set as default shell."
fi
}
install_omf() {
echo "Installing omf (Oh-My-Fish)..."
echo "(EXPERIMENTAL) - Do you want to install omf (Oh-My-Fish)? (y/n): "
read -r omf
[[ "$omf" == "y" ]] || [[ -z "$omf" ]] && curl https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install | fish
echo "Finished installing omf."
}
install_fisher() {
curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher
}
install_fisher_plugins() {
fisher install g-plane/pnpm-shell-completion
}
install_foundry() {
echo "Installing Foundry..."
curl -L https://foundry.paradigm.xyz | bash
echo "Finished installing Foundry."
}
symlink_dotfiles() {
echo "Symlinking dotfiles..."
ln -fs $dotfiles_path/.gitconfig ~/.gitconfig
[ -d "~/.config/fish/functions" ] || mkdir -p ~/.config/fish/functions
ln -fs $dotfiles_path/functions/* ~/.config/fish/functions/
ln -fs $dotfiles_path/starship.toml ~/.config/
ln -fs $dotfiles_path/alacritty/alacritty.yml ~/.config/alacritty.yml
[ -d "~/.config/sketchybar" ] || mkdir -p ~/.config/sketchybar
[ -d "~/.config/sketchybar/plugins" ] || mkdir -p ~/.config/sketchybar/plugins
[ -d "~/.config/sketchybar/items" ] || mkdir -p ~/.config/sketchybar/items
[ -d "~/.config/sketchybar/helper" ] || mkdir -p ~/.config/sketchybar/helper
[ -d "~/.hammerspoon" ] || mkdir -p ~/.hammerspoon
ln -fs $dotfiles_path/.hammerspoon/ ~/.hammerspoon
ln -fs $dotfiles_path/sketchybar/sketchybarrc ~/.config/sketchybar/sketchybarrc
ln -fs $dotfiles_path/sketchybar/colors.sh ~/.config/sketchybar/colors.sh
ln -fs $dotfiles_path/sketchybar/icons.sh ~/.config/sketchybar/icons.sh
ln -fs $dotfiles_path/sketchybar/helper/* ~/.config/sketchybar/helper
ln -fs $dotfiles_path/sketchybar/plugins/* ~/.config/sketchybar/plugins
ln -fs $dotfiles_path/sketchybar/items/* ~/.config/sketchybar/items
[ -d "~/.config/borders" ] || mkdir -p ~/.config/borders
ln -fs $dotfiles_path/borders/bordersrc ~/.config/borders/bordersrc
echo "Downloading required fonts for Sketchybar..."
curl -L https://github.com/kvndrsslr/sketchybar-app-font/releases/download/v1.0.16/sketchybar-app-font.ttf -o $HOME/Library/Fonts/sketchybar-app-font.ttf
[ -d "~/.config/fish" ] || mkdir -p ~/.config/fish
ln -fs $dotfiles_path/pseudobun.fish ~/.config/fish
ln -fs $dotfiles_path/yabai/.yabairc ~/.yabairc
ln -fs $dotfiles_path/yabai/.skhdrc ~/.skhdrc
echo "Finished symlinking dotfiles."
}
install_rust() {
echo "Installing Rust..."
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
echo "Finished installing Rust."
}
install_asdf() {
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.0
mkdir -p ~/.config/fish/completions
and ln -s ~/.asdf/completions/asdf.fish ~/.config/fish/completions
}
install_deno() {
echo "Installing Deno..."
curl -fsSL https://deno.land/install.sh | sh
echo "Finished installing Deno."
}
install_bun() {
echo "Installing Bun..."
curl -fsSL https://bun.sh/install | bash
echo "Finished installing Bun."
}
install_appstore_apps() {
# Dropover
mas install 1355679052
# Raivo OTP
mas install 1498497896
# Wireguard
mas install 1451685025
# Magnet
mas install 441258766
# Reeder
mas install 1529448980
}
install_spicetify() {
echo "Installing Spicetify..."
curl -fsSL https://raw.githubusercontent.com/spicetify/spicetify-cli/master/install.sh | sh
curl -fsSL https://raw.githubusercontent.com/spicetify/spicetify-marketplace/main/resources/install.sh | sh
echo "Finished installing Spicetify."
}
setup_macos_defaults() {
echo "Setting up MacOS defaults..."
defaults write .GlobalPreferences com.apple.mouse.scaling -1
defaults write com.apple.dock autohide-time-modifier -float 0.05
defaults write com.apple.dock "scroll-to-open" -bool "true"
echo "Finished setting up MacOS defaults."
}
start_services() {
brew services start sketchybar
yabai --stop-service
skhd --stop-service
yabai --start-service
skhd --start-service
spicetify apply
echo "yabai and skhd services have been installed. remember to edit the .plist files to change default shell to /bin/sh, see: https://gist.github.com/pseudobun/34c42b0bf20e82f114fd232c8ce55fe2"
}
auth_gh() {
gh auth login
}
main() {
install_xcode_tools
clone_dotfiles_repo
manage_homebrew
set_fish_shell
install_omf
install_fisher
install_fisher_plugins
setup_gpg
symlink_dotfiles
fish ./setup.fish
install_rust
install_foundry
install_bun
install_spicetify
setup_macos_defaults
install_kitty
# Not needed apparently brewfile has this all covered
# install_appstore_apps
auth_gh
start_services
echo "Finished setting up pseudobun's dotfiles."
echo "Make sure everything is ok and reboot your Mac."
fish
}
main "$@"