-
Notifications
You must be signed in to change notification settings - Fork 7
/
bootstrap.sh
executable file
·186 lines (157 loc) · 5.1 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
#!/bin/zsh
brew_formulas=(
curl
gpg-suite
gpg-agent
git
gh
go
httpie
lazygit
pinentry-mac
postgresql@16
neovim
nodenv
pyenv
wget
zlib
)
brew_casks=(
appcleaner
bitwarden
brave-browser
discord
firefox
firefox-developer-edition
google-chrome
google-chrome-canary
iina
istat-menus
iterm2
pgadmin4
rectangle
slack
spotify
transmission
visual-studio-code
)
brews() {
for package in "${brew_formulas[@]}"; do
if brew info $package | grep "Not installed" >/dev/null; then
printf "\e[0;32m * Installing ${package}, please wait... \e[0m\n\n"
brew install $package
echo ""
else
printf "\e[0;32m * ${package} is already installed. \n\e[0m"
fi
done
}
casks() {
for package in "${brew_casks[@]}"; do
printf "\e[1;32m\nInstalling \e[1;34m$package\e[0m\n"
echo ""
brew install --cask $package
done
}
###############################################################################
# >>>>> Begin Here <<<<<
###############################################################################
echo ""
printf "%s" $'\e[1;32m
██████╗ ██████╗ ███╗ ██╗ ██████╗ ███████╗████████╗██████╗
██╔══██╗██╔═══██╗████╗ ██║██╔════╝ ██╔════╝╚══██╔══╝██╔══██╗
██████╔╝██║ ██║██╔██╗ ██║██║ ███╗███████╗ ██║ ██████╔╝
██╔═══╝ ██║ ██║██║╚██╗██║██║ ██║╚════██║ ██║ ██╔══██╗
██║ ╚██████╔╝██║ ╚████║╚██████╔╝███████║ ██║ ██║ ██║
╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝\e[1;31m
Dotfiles v0.5.0 https://github.com/pongstr/dotfiles\e[0m\n'
echo "
--> For added privacy invasion I'll need your local account's password.
"
# Close any open System Preferences panes, to prevent them from overriding
# settings we’re about to change
osascript -e 'tell application "System Preferences" to quit'
# Ask for the administrator password upfront
# This prompt is taken from `boxen-web`, see https://github.com/boxen/boxen-web
sudo -p " Password for sudo: " echo " Thanks! See you in vegas sucker!"
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
while true; do
sudo -n true
sleep 60
kill -0 "$$" || exit
done 2>/dev/null &
touch .hushlogin
echo "
--> Where would you like to install the setup files? "
read -p " defaults to /opt/dotfiles
" INSTALL_DIR
if [ -z $INSTALL_DIR ]; then
INSTALL_DIR="dotfiles"
fi
if [ -d "/opt/${INSTALL_DIR}" ]; then
sudo mkdir -p /opt/$INSTALL_DIR
sudo chown ${USER}:staff /opt/$INSTALL_DIR
git clone --depth=1 --branch=main https://github.com/pongstr/dotfiles.git /opt/$INSTALL_DIR
fi
if ! hash brew 2>/dev/null; then
printf "
Awesome! Homebrew is installed! Now updating...\n\n\e[0m"
brew doctor && brew update && brew upgrade && brew cleanup
else
printf "\e[0;1m
Did not find Homebrew installation, installing it now...\e[0m\n\n"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew doctor
brews
casks
brew tap homebrew/cask-fonts
brew install font-hack-nerd-font
brew jandedobbeleer/oh-my-posh/oh-my-posh
fi
if ! hash omz 2>/dev/null; then
printf "
Installing OhMyZSH...\n\n\e[0m"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
curl -L -o $HOME/.oh-my-zsh/themes/pongstr.zsh-theme https://raw.githubusercontent.com/pongstr/dotfiles/main/.omzsh/pongstr.zsh-theme
cp $INSTALL_DIR/.zshrc $HOME/.zshrc
else
omz update
curl -L -o $HOME/.oh-my-zsh/themes/pongstr.zsh-theme https://raw.githubusercontent.com/pongstr/dotfiles/main/.omzsh/pongstr.zsh-theme
cp $INSTALL_DIR/.zshrc $HOME/.zshrc
fi
if ! hash nvim 2>/dev/null; then
printf "
Setting up NeoVim...\n\n\e[0m"
git clone https://github.com/pongstr/kickstart.nvim.git $HOME/.config/nvim
nvim --headless "+Lazy! sync" +qa
nvim +'checkhealth' +qa
fi
if ! hash pyenv 2>/dev/null; then
printf "
Setting up Python...\n\n\e[0m"
pyenv install 3.12
pyenv global 3.12
fi
if ! hash nodenv 2>/dev/null; then
printf "
Setting up Node...\n\n\e[0m"
nodenv install 20.11.1
nodenv global 20.11.1
fi
source $HOME/.zshrc
sleep 1
## supporting tools for neovim
if hash nodenv 2>/dev/null; then
npm i -g npm
npm i -g neovim eslint prettier
curl -fsSL https://get.pnpm.io/install.sh | sh -
fi
if hash nodenv 2>/dev/null; then
python -m pip install --upgrade neovim
python -m pip install --upgrade pynvim black
fi
if hash git 2>/dev/null; then
printf "
Setting up Git Config...\n\n\e[0m"
./gitconfig.sh
fi