-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
executable file
·146 lines (123 loc) · 3.48 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
#!/usr/bin/env zsh
function moveAndLink() {
if [ -e $1 ] && [ ! -h $1 ]; then
echo "mv $1 $1.old"
mv $1 $1.old
fi
if [ ! -e $1 ]; then
echo "ln -s $2 $1"
ln -s $2 $1
fi
}
function installOrUpdate() {
if [ ! -d $1 ]; then
echo "git clone $2 $1"
git clone $2 $1
else
echo "Updating $1"
cd $1
git pull
cd $dotfiles
fi
}
function createOverrides() {
if [ ! -e $1.overrides ]; then
echo "Creating $1.overrides"
echo "$2 For things I don't want to accidentally commit" > $1.overrides
fi
}
function brewInstallOrUpgrade() {
for pkg in "$@"; do
if brew ls --versions "$pkg" >/dev/null; then
HOMEBREW_NO_AUTO_UPDATE=1 brew upgrade "$pkg"
else
HOMEBREW_NO_AUTO_UPDATE=1 brew install "$pkg"
fi
done
}
function brewCaskInstallOrUpgrade() {
for pkg in "$@"; do
if brew ls --versions "$pkg" >/dev/null; then
HOMEBREW_NO_AUTO_UPDATE=1 brew upgrade --cask "$pkg"
else
HOMEBREW_NO_AUTO_UPDATE=1 brew install --cask "$pkg"
fi
done
}
function pipInstallOrUpgrade() {
for pkg in "$@"; do
if pip3 show "$pkg" >/dev/null; then
pip3 install "$pkg" --upgrade
else
pip3 install "$pkg"
fi
done
}
function gemInstallOrUpgrade() {
for pkg in "$@"; do
if gem list -i "$pkg" >/dev/null; then
gem update "$pkg"
else
gem install "$pkg"
fi
done
}
git submodule init
git submodule update --remote
dotfiles=`pwd`
ruby_version=3.1.0
mkdir -p $HOME/.config
mkdir -p $dotfiles/vim/undo
mkdir -p $HOME/development
createOverrides $HOME/.zshrc \#
createOverrides $HOME/.vimrc \"
# Install Oh-my-zsh
if [ ! -d $HOME/.oh-my-zsh ]; then
echo "Installing Oh My Zsh."
curl -o install.sh https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh
RUNZSH=no sh install.sh
fi
# link all the things
echo "Linking custom zsh files"
ln -s $dotfiles/oh-my-zsh-custom/* $HOME/.oh-my-zsh/custom
moveAndLink $HOME/.config/powerline $dotfiles/powerline-config
moveAndLink $HOME/.vim $dotfiles/vim
moveAndLink $HOME/.config/nvim $dotfiles/nvim
moveAndLink $HOME/.gitconfig $dotfiles/gitconfig
moveAndLink $HOME/.gitignore_global $dotfiles/gitignore_global
moveAndLink $HOME/.tmux.conf $dotfiles/tmux.conf
moveAndLink $HOME/.vimrc $dotfiles/vimrc
moveAndLink $HOME/.zshrc $dotfiles/zshrc
# install or update all the things
installOrUpdate $HOME/.config/base16-shell https://github.com/chriskempson/base16-shell
# Install or update Homebrew
which -s brew
if [[ $? != 0 ]] ; then
echo "Installing Homebrew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
else
echo "Updating Homebrew"
brew update
fi
git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
# brew install all the things
echo "brew install/upgrade"
brew tap coursier/formulas
brew tap AdoptOpenJDK/openjdk
brew tap homebrew/cask-fonts
brewInstallOrUpgrade font-fira-code-nerd-font
brewInstallOrUpgrade python3 autojump python fortune cowsay rbenv ruby-build tmux rg fzf go neovim coursier/formulas/coursier git-extras
# Install Ruby and lolcat
if [ ! -d $HOME/.rbenv/versions/$ruby_version ]; then
echo "Installing ruby $ruby_version"
rbenv install $ruby_version
rbenv global $ruby_version
eval "$(rbenv init -)"
fi
gemInstallOrUpgrade lolcat tmuxinator
# Install neovim
echo "pip install/upgrade"
pipInstallOrUpgrade neovim powerline-status
# source zshrc and Set base16 theme
source $HOME/.zshrc
base16_materia