Repository navigation
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·275 lines (207 loc) · 8.53 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·275 lines (207 loc) · 8.53 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
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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
#!/bin/bash
# Installs the various tools leveraged by the configuration files in this
# collection and links those configuration files into place.
# TODO:
# brew install sox (GpChat whisper functionality)
# brew install pngpaste (Obsidian image paste functionality)
# ---
# Pre-Install
# ---
# Set a path we can count on. Otherwise things can get strange/circular.
export PATH="/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
# Verify brew exists. If not then stop right now.
if [[ $(which brew) ]]; then
echo 'Homebrew (brew) found. Verifying brew installation...'
if [[ $(brew doctor) ]]; then
echo 'Your system is ready to brew.'
else
echo 'Repair brew doctor issues and retry.'
exit
fi
else
echo 'Homebrew (brew) not found. Install brew and retry.'
echo 'install brew via:'; echo
echo 'ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"'
exit
fi
# Install the node version manager and use it to install node.js/npm. Note that
# the 'nvm use' here adds to the start of our path for subsequent node calls.
echo 'Checking for nvm and node.js...'
if [[ -d ~/.nvm ]]; then
echo 'Found nvm.'
else
echo 'Installing nvm via curl...'
curl https://raw.githubusercontent.com/creationix/nvm/v0.25.1/install.sh | bash
fi
echo 'Installing latest 16.10.0 node.js...'
source ~/.nvm/nvm.sh > /dev/null 2>&1
nvm install v16.10.0
nvm use v16.10.0
# We use a lot of submodules in the vim section in particular.
# Note we checkout master to avoid detached HEAD conditions.
echo 'Updating git submodules...'
git submodule init
git submodule update --recursive
git submodule foreach 'git fetch origin; git checkout master; git pull'
# ---
# Shell Etc.
# ---
# Configure a root we can simplify our references in this script with.
export DOTFILES="$HOME/.dotfiles"
echo 'Creating working directories...'
[[ -d ~/dev ]] || mkdir ~/dev > /dev/null 2>&1
[[ -d ~/tmp ]] || mkdir ~/tmp > /dev/null 2>&1
echo 'Verifying zsh installation...'
[[ $(brew list zsh) ]] > /dev/null 2>&1 || \
(echo 'Installing zsh via brew...' && brew install zsh)
# ---
# Command-line utilities
# ---
echo 'Verifying command line utilities...'
# Ack is my default search tool from the command line.
echo 'Checking for ack...'
[[ $(brew list ack) ]] > /dev/null 2>&1 || \
(echo 'Installing ack via brew...' && brew install ack)
# Supposedly even faster than ack for codebase searches.
echo 'Checking for ag...'
[[ $(brew list ag) ]] > /dev/null 2>&1 || \
(echo 'Installing ag via brew...' && brew install ag)
# Install cloc (lines of code) utility for sizing codebases.
echo 'Checking for cloc...'
[[ $(brew list cloc) ]] > /dev/null 2>&1 || \
(echo 'Installing cloc via brew...' && brew install cloc)
# Install CTAGS to provide support for jstags alias in zsh config.
echo 'Checking for ctags...'
[[ $(brew list ctags) ]] > /dev/null 2>&1 || \
(echo 'Installing ctags via brew...' && brew install ctags)
# TODO: I branched this repo to add enterprise support. Update when that's ready
# so we install my branch rather than the npm module (until changes merge ;)).
# gh (GitHub CLI)
echo 'Checking for gh (GitHub CLI)...'
[[ $(npm info gh) ]] > /dev/null 2>&1 || \
(echo 'Installing gh via npm...' && npm install -g gh)
# Some cut/paste installs from the web rely on wget so install it.
echo 'Checking for wget...'
[[ $(brew list wget) ]] > /dev/null 2>&1 || \
(echo 'Installing wget via brew...' && brew install wget)
# ---
# Languages
# ---
echo 'Verifying language support...'
# Install updated python for pip, powerline, etc.
echo 'Checking for python...'
[[ $(brew list python) ]] > /dev/null 2>&1 || \
(echo 'Installing python via brew...' && brew install python)
# Install chruby and ruby-install to manage any Ruby code.
echo 'Checking for ruby-install'
[[ $(brew list ruby-install) ]] > /dev/null 2>&1 || \
(echo 'Installing ruby-install via brew...' && \
brew install ruby-install)
echo 'Installing Ruby baseline'
ruby-install ruby 3.1.0 --no-reinstall
echo 'Checking for chruby...'
[[ $(brew list chruby) ]] > /dev/null 2>&1 || \
(echo 'Installing chruby via brew...' && \
brew install chruby)
echo 'Ruby versions:'
chruby
echo 'Checking for chgems...'
[[ $(brew list chgems) ]] > /dev/null 2>&1 || \
(echo 'Installing chgems via brew...' && \
brew install https://raw.github.com/postmodern/chgems/master/homebrew/chgems.rb)
# ---
# Applications
# ---
echo 'Verifying application support...'
# Install (Mac)VIM and link MacVIM into Applications dir. NOTE this requires
# XCode, full XCode, not just command line tools.
echo 'Checking for macvim and vim...'
[[ $(brew list macvim) ]] > /dev/null 2>&1 || \
(echo 'Installing macvim via brew...' && \
brew install --cask macvim)
(echo 'Installing vim via brew...' && \
brew install --cask vim)
# Install TMUX support and MacOSX patches for clipboard.
echo 'Checking for tmux...'
[[ $(brew list tmux) ]] > /dev/null 2>&1 || \
(echo 'Installing tmux via brew...' && brew install tmux)
echo 'Checking for tmux macosx clipboard patches...'
[[ $(brew list reattach-to-user-namespace) ]] > /dev/null 2>&1 || \
(echo 'Installing reattach-to-user-namespace via brew...' && brew install reattach-to-user-namespace)
# TODO: powerline configuration
# Install powerline fonts so we see what we want in vim and tmux status bars.
echo 'Checking for powerline-font installation...'
if [[ ! -e /Library/Fonts/Inconsolata\ for\ Powerline.otf ]]; then
echo 'Installing powerline-font fonts in /Library/Fonts...'
find $DOTFILES/util/powerline -name "*.otf" -exec cp '{}' /Library/Fonts \;
find $DOTFILES/util/powerline-fonts -name "*.otf" -exec cp '{}' /Library/Fonts \;
fi
# ---
# Links
# ---
echo 'Linking in profile configuration files...'
# Patch up Apache legacy links to match historical aliases.
# Apache on OSX 10.8 + doesn't provide the older standard locations.
echo 'Checking legacy apache2 links...'
[[ -e /etc/apache2/htdocs ]] || (sudo ln -s /Library/WebServer/Documents /etc/apache2/htdocs > /dev/null 2>&1)
[[ -e /etc/apache2/cgi-bin ]] || (sudo ln -s /Library/WebServer/CGI-Executables /etc/apache2/cgi-bin > /dev/null 2>&1)
# bin directory
\mv -f ~/bin ~/bin_orig > /dev/null 2>&1
ln -sfFv $DOTFILES/bin ~/
rm -rf bin/bin > /dev/null 2>&1
# ack
\mv -f ~/.ackrc ~/.ackrc_orig > /dev/null 2>&1
ln -sfv $DOTFILES/ack/ackrc ~/.ackrc
# git
\mv -f ~/.gitconfig ~/.gitconfig_orig > /dev/null 2>&1
\cp -fv $DOTFILES/git/gitconfig.idearat ~/.gitconfig
\mv -f ~/.gitignore ~/.gitignore_orig > /dev/null 2>&1
\cp -fv $DOTFILES/git/gitignore.idearat ~/.gitignore
\mv -f ~/.gitmessage.txt ~/.gitmessage.txt_orig > /dev/null 2>&1
\cp -fv $DOTFILES/git/gitmessage.txt.idearat ~/.gitmessage.txt
# ruby
\mv -f ~/.gemrc ~/.gemrc_orig > /dev/null 2>&1
ln -sfv $DOTFILES/ruby/gemrc ~/.gemrc
\mv -f ~/.irbrc ~/.irbrc_orig > /dev/null 2>&1
ln -sfv $DOTFILES/ruby/irbrc ~/.irbrc
\mv -f ~/.rdebugrc ~/.rdebugrc_orig > /dev/null 2>&1
ln -sfv $DOTFILES/ruby/rdebugrc ~/.rdebugrc
# tmux
\mv -f ~/.tmux.conf ~/.tmux.conf_orig > /dev/null 2>&1
ln -sfv $DOTFILES/tmux/tmux.conf ~/.tmux.conf
\mv -f ~/.tmux_status.conf ~/.tmux_status.conf_orig > /dev/null 2>&1
ln -sfv $DOTFILES/tmux/tmux_status.conf ~/.tmux_status.conf
# vim
\mv -f ~/.editorconfig ~/.editorconfig_orig > /dev/null 2>&1
ln -sfv $DOTFILES/vim/editorconfig ~/.editorconfig
\mv -f ~/.gvimrc ~/.gvimrc_orig > /dev/null 2>&1
ln -sfv $DOTFILES/vim/gvimrc ~/.gvimrc
\mv -f ~/.vim ~/.vim_orig > /dev/null 2>&1
ln -sfFv $DOTFILES/vim/vim ~/.vim
rm -rf vim/vim/.vim > /dev/null 2>&1
\mv -f ~/.vimrc ~/.vimrc_orig > /dev/null 2>&1
ln -sfv $DOTFILES/vim/vimrc ~/.vimrc
\mv -f ~/.vimrc.after ~/.vimrc.after_orig > /dev/null 2>&1
ln -sfv $DOTFILES/vim/vimrc.after ~/.vimrc.after
ln -sfv ~/Dropbox/vimrc.local ~/.vimrc.local
\mv -f ~/.zshrc ~/.zshrc_orig > /dev/null 2>&1
ln -sfv $DOTFILES/zsh/zshrc ~/.zshrc
\mv -f ~/.shell_prompt.sh ~/.shell_prompt_orig.sh > /dev/null 2>&1
ln -sfv $DOTFILES/zsh/shell_prompt.sh ~/.shell_prompt.sh
\mv -f ~/.tibetrc ~/.tibetrc_orig > /dev/null 2>&1
ln -sfv $DOTFILES/tibet/tibetrc ~/.tibetrc
# ---
# Post-Install
# ---
echo 'Installation complete.'; echo
# TODO: echo set of 'post-install hints'
echo 'Post-installation options:'; echo
echo 'To make zsh your default shell (and you should now):'
echo 'chsh -s /usr/local/bin/zsh'; echo
echo 'To change your hostname display:'; echo
echo 'sudo scutil --set HostName name-you-want'; echo
echo 'To remove _orig files use:'
echo "\ls -a | grep \'_orig$\' | xargs -n 1 rm -rf";
echo "or 'rmorig' from your home directory if safe."; echo
echo 'For best results close all terminals now and reopen them.'
echo 'Enjoy!'