-
Notifications
You must be signed in to change notification settings - Fork 0
/
.setup.sh
executable file
·258 lines (215 loc) · 9.09 KB
/
.setup.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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
#!/usr/bin/env bash
# switching section
YELLOW='\033[1;33m'
# info
GRAY='\033[1;30m'
# making change
PURPLE='\033[1;35m'
# No Color
NC='\033[0m'
##############################################################
# Basics (git & dotfiles)
##############################################################
echo -e "\n\n\n${PURPLE}---- Check for Apple Software Updates then restart your computer. \n Have you done this (no seriously!)${NC}"
echo -e "\n\n\n${YELLOW}---- installing Xcode command tools (without all of Xcode)${NC}"
touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress;
softwareupdate --install -a --verbose
rm -f /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
# install xcode
# xcode-select --install
echo -e "${YELLOW}---- setting up homebrew${NC}"
if ! command -v brew &>/dev/null; then
echo -e "\n\n\n${YELLOW}---- Homebrew not found. Installing...${NC}"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
else
echo -e "${GRAY}---- Homebrew is already installed.${NC}"
fi
echo -e "${GRAY}---- Turning homebrew analytics off.${NC}"
brew analytics off
echo -e "${YELLOW}---- setting up github${NC}"
brew install git
brew install gh
echo -e "\n\n\n${YELLOW}---- Setting up git${NC}"
gh auth status &> tmp_gh_login.txt
if grep -om1 "Logged in" tmp_gh_login.txt; then
rm -f tmp_gh_login.txt
echo -e "${GRAY}---- logged in to github${NC}"
else
rm -f tmp_gh_login.txt
echo -e "${PURPLE}---- you need to setup github, follow the prompts now ${NC}"
gh auth login
fi
echo -e "${YELLOW}---- setting up dotfiles${NC}"
cd $HOME
if git rev-parse --git-dir > /dev/null 2>&1; then
echo -e "${GRAY}---- looks like dotfile repo is setup${NC}"
else
echo -e "${PURPLE}---- setting up home to point to dotfiles${NC}"
git init -b master
git remote add origin https://github.com/kaushikgopal/dotfiles.git
git fetch origin
git reset --hard origin/master
fi
git config --global credential.helper osxkeychain
echo -e "${YELLOW}---- Asking for an admin password upfront${NC}"
sudo -v
function delete_if_exists {
if [ -f "$1" ]; then
# echo -e "$1 exists."
echo -e "${PURPLE}---- $1 present, so deleting${NC}"
sudo rm "$1"
# else
# echo -e "$1 does not exist."
fi
}
function clone_if_absent {
if [ ! -d "$1" ]; then
echo -e "${PURPLE}---- $1 not present, so cloning${NC}"
git clone $2 $1
else
echo -e "${GRAY}---- $1 already present. pulling latest version${NC}"
cd $1
git pull
cd ..
fi
}
# echo -e "${GRAY}---- delete native git if it exists${NC}"
# # sudo rm -rf /usr/bin/git
# delete_if_exists /etc/paths.d/git
# delete_if_exists /etc/manpaths.d/git
# # sudo pkgutil --forget --pkgs=GitOSX\.Installer\.git[A-Za-z0-9]*\.[a-z]*.pkg
##############################################################
# zsh shell
##############################################################
#echo -e "\n\n\n${YELLOW}---- Setting up zsh shell through brew${NC}"
#brew install zsh
curl https://lab.al0.de/a0n/oh-my-zsh/-/raw/master/plugins/adb/_adb > $(brew --prefix)/share/zsh/site-functions/_adb
chmod +x $(brew --prefix)/share/zsh/site-functions/_adb
##############################################################
# Fish shell
##############################################################
# echo -e "\n\n\n${YELLOW}---- Setting up Fish${NC}"
# if [[ $(uname -p) == 'arm' ]]; then
# if grep -Fxq "/opt/homebrew/bin/fish" /etc/shells; then
# echo -e "${GRAY}---- fish declaration present${NC}"
# else
# echo "/opt/homebrew/bin/fish" | sudo tee -a /etc/shells
# fi
# else
# if grep -Fxq "/usr/local/bin/fish" /etc/shells; then
# echo -e "${GRAY}---- fish declaration present${NC}"
# else
# echo "/usr/local/bin/fish" | sudo tee -a /etc/shells
# fi
# fi
# if [[ "fish" == $(basename "${SHELL}") ]]; then
# echo -e "${GRAY}---- default shell is fish${NC}"
# else
# echo -e "${GRAY}---- default shell is NOT fish${NC}"
# if [[ $(uname -p) == 'arm' ]]; then
# chsh -s /opt/homebrew/bin/fish
# else
# chsh -s /usr/local/bin/fish
# fi
# fi
# echo -e "${GRAY}---- symlink fish_history ${NC}"
# trash ~/.local/share/fish/fish_history
# ln -s $XDG_DATA_HOME/fish/fish_history ~/.local/share/fish/
##############################################################
# DEV
##############################################################
#echo -e "\n\n\n${YELLOW}---- Setting up VSCode${NC}"
#echo -e "${PURPLE}---- remove existing settings if it exists${NC}"
#trash ~/Library/Application\ Support/Code/User/settings.json
#echo -e "${PURPLE}---- symlink .config version${NC}"
#ln -s $XDG_CONFIG_HOME/vscode-settings.json ~/Library/Application\ Support/Code/User/settings.json
#echo -e "\n\n\n${YELLOW}---- Setting up (neo)vim${NC}"
#mkdir -p $HOME/.vim/pack/kg/start
#cd $HOME/.vim/pack/kg/start
# clone_if_absent surround https://github.com/tpope/vim-surround.git
# clone_if_absent vim-polyglot https://github.com/sheerun/vim-polyglot
# clone_if_absent vim-smoothie https://github.com/psliwka/vim-smoothie.git
# clone_if_absent vim-vinegar https://github.com/tpope/vim-vinegar
# clone_if_absent targets https://github.com/wellle/targets.vim.git
#clone_if_absent plenary https://github.com/nvim-lua/plenary.nvim
#clone_if_absent telescope https://github.com/nvim-telescope/telescope.nvim
#clone_if_absent telescope-fzy-native https://github.com/nvim-telescope/telescope-fzy-native.nvim
#
#clone_if_absent vim-table-mode https://github.com/dhruvasagar/vim-table-mode.git
# # clone_if_absent vim-livedown https://github.com/shime/vim-livedown.git
# #clone_if_absent vimwiki "https://github.com/vimwiki/vimwiki --branch dev"
# #clone_if_absent taskwiki https://github.com/tools-life/taskwiki
#
# #clone_if_absent vim-monokai-pro https://github.com/phanviet/vim-monokai-pro.git
#clone_if_absent vim-colors-xcode https://github.com/arzg/vim-colors-xcode.git
# #clone_if_absent vim-airline https://github.com/vim-airline/vim-airline.git
# #clone_if_absent vim-airline-themes https://github.com/vim-airline/vim-airline-themes.git
# #clone_if_absent nord-vim https://github.com/arcticicestudio/nord-vim.git
# # clone_if_absent limelight https://github.com/junegunn/limelight.vim.git
# # clone_if_absent goyo https://github.com/junegunn/goyo.vim.git
# mkdir -p $HOME/_src
# cd $HOME/_src
#clone_if_absent gruvbox-idea https://github.com/kaushikgopal/gruvbox-idea.git
#clone_if_absent monokaush https://github.com/kaushikgopal/monokaush.git
#clone_if_absent xcode-11-theme https://github.com/kaushikgopal/xcode-11-theme.git
#clone_if_absent nord-iterm2 https://github.com/kaushikgopal/nord-iterm2.git
# clone_if_absent nord-terminal-app https://github.com/kaushikgopal/nord-terminal-app.git
# clone_if_absent nord-jetbrains https://github.com/kaushikgopal/nord-jetbrains.git
echo -e "${GRAY}---- moving home${NC}"
cd ~
# echo -e "\n\n\n${YELLOW}---- Install rbenv/ruby${NC}"
# installs the same ruby version as homebrew just installed via vim
# rbenv install -s $(brew info ruby | awk 'NR==1{print $3}')
# rbenv global $(brew info ruby | awk 'NR==1{print $3}')
# now pin ruby to this version, so it doesn't change on you with brew update
# brew pin ruby
# install bundler and gem stuff
# do this on a new terminal
# gem install bundler
#echo -e "\n\n\n${YELLOW}---- setup for go development${NC}"
#mkdir -p $HOME/_src/go
#mkdir -p $HOME/_src/go/src
# echo -e "\n\n\n${YELLOW}---- setup for python development${NC}"
# python setup
# pyenv install --list
# pyenv install 3.10.1
#ln -s -f /usr/local/bin/python3 /usr/local/bin/python
##############################################################
# MISC.
##############################################################
if [ ! -f /usr/local/bin/pdflatex ]; then
echo -e "\n\n\n${PURPLE}---- enable quick look plugins${NC}"
sudo ln -s /Library/Tex/Distributions/.DefaultTeX/Contents/Programs/x86_64/pdflatex /usr/local/bin/
fi
# echo -e "\n\n\n${YELLOW}---- Install TaskWarrior dependencies${NC}"
# needed for shift-recurrence pirate
# pip3 install --user git+git://github.com/GothenburgBitFactory/tasklib@develop
source $HOME/.brew.sh
$(brew --prefix)/opt/fzf/install
# source $HOME/.macos.sh
# source $HOME/.cleanup.sh
# if (( $# > 0 ))
# then
# # atleast one argument supplied
# echo -e "${GRAY}---- ignoring OS updates${NC}"
# echo -e "${GRAY}---- ignoring Mac specific changes${NC}"
# else
# source $HOME/.config/macos.sh
#
# echo -e "\n\n\n${YELLOW}---- running macOS system update now${NC}"
# touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress;
# softwareupdate --install -a --verbose
# rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
xcode-select --install
#sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcode-select --switch /Library/Developer/CommandLineTools/
# fi
# SDK man for .kt dev & kscript
curl -s "https://get.sdkman.io" | bash
sdk install kotlin 1.9.24
mkdir -p ~/.warp/themes
pushd ~/.warp/themes
git clone https://github.com/juliabresolin/warp-theme-dark-modern
popd
unset delete_if_exists;
unset clone_if_absent;