-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
executable file
·175 lines (136 loc) · 5.2 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
#!/bin/bash
set -e
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until this script has finished
while true; do
sudo -n true
sleep 60
kill -0 "$$" || exit
done 2>/dev/null &
if [[ "$OSTYPE" == "darwin"* ]]; then
#####################################
##################### MacOS env setup
#####################################
if ! hash brew 2>/dev/null; then
echo "Installing Brew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
hash brew 2>/dev/null || {
echo "install brew first"
exit 1
}
brew doctor
brew tap homebrew/cask-versions
brew tap homebrew/cask-fonts
echo "getting some important extra brew packages"
brew install screen the_silver_searcher git curl hub fd fzf wget cmake node
# This little joke kills some of our nicest code.
test -r /etc/bashrc_Apple_Terminal &&
sudo mv /etc/bashrc_Apple_Terminal /etc/bashrc_Apple_Terminal.disabled
elif [[ -f /etc/redhat-release ]]; then
#####################################
##################### RH-ish env setup
#####################################
# Enable Fedora
sudo dnf copr enable tkbcopr/fd -y
sudo dnf install -y the_silver_searcher curl git fd tmux
[[ ! -d ~/.fzf ]] &&
git clone -q --depth 1 https://github.com/junegunn/fzf.git ~/.fzf &&
~/.fzf/install --all --no-zsh --no-fish --no-update-rc
elif [[ "$(lsb_release -is)" == "Ubuntu" ]] || [[ "$(lsb_release -is)" == "Debian" ]]; then
#####################################
#################### Ubuntu env setup
#####################################
echo "installing some essential packages"
sudo apt update
sudo apt install -y screen silversearcher-ag curl git \
software-properties-common python3-pip rubygems tmux build-essential \
cmake python3-dev nodejs npm python-dev
# Adding backports, neovim and other useful bits.
sudo add-apt-repository -u "deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-backports main restricted universe multiverse"
if ! hash nvim 2>/dev/null; then
echo "install neovim, trying from default sources"
sudo apt install -y neovim || {
sudo add-apt-repository -u ppa:neovim-ppa/stable -y && sudo apt update
sudo apt-get install -y neovim
sudo update-alternatives --set editor /usr/bin/nvim
sudo update-alternatives --set ex /usr/bin/ex.nvim
sudo update-alternatives --set rview /usr/bin/rview.nvim
sudo update-alternatives --set rvim /usr/bin/rvim.nvim
sudo update-alternatives --set vi /usr/bin/nvim
sudo update-alternatives --set view /usr/bin/view.nvim
sudo update-alternatives --set vim /usr/bin/nvim
sudo update-alternatives --set vimdiff /usr/bin/vimdiff.nvim
}
fi
# Download fd
if hash fd 2>/dev/null; then
echo "fd exists."
else
fdversion=7.2.0
wget -q https://github.com/sharkdp/fd/releases/download/v${fdversion}/fd_${fdversion}_amd64.deb &&
sudo dpkg -i fd_${fdversion}_amd64.deb
rm -Rf fd_${fdversion}_amd64.deb
fi
[[ ! -d ~/.fzf ]] &&
git clone -q --depth 1 https://github.com/junegunn/fzf.git ~/.fzf &&
~/.fzf/install --all --no-zsh --no-fish --no-update-rc
fi
###########################
#################### Common
###########################
[[ -d "$HOME/.homesick/repos/homeshick" ]] ||
git clone https://github.com/andsens/homeshick.git "$HOME/.homesick/repos/homeshick"
# shellcheck disable=SC1091
source "$HOME/.homesick/repos/homeshick/homeshick.sh"
# Have ensured that homesick is available
hash homeshick 2>/dev/null || (echo "homeshick install failed" && exit 1)
pip3 install --upgrade powerline-status --user
if [[ -d "$HOME/.homesick/repos/dotfiles" ]]; then
echo "Oh good, the homeshick is already checked out..."
else
## Clone dotfiles
echo "Cloning the dotfiles"
homeshick clone seefood/dotfiles
while read -r dir; do
mkdir -p ~/"${dir}"
done <~/.homesick/repos/dotfiles/.homesick_subdir
fi
homeshick symlink dotfiles
[[ -r ~/.gitconfig.local ]] || cp ~/.gitconfig.local.example ~/.gitconfig.local
chmod 700 ~/.gnupg/
echo "Make sure you have your correct settings in ~/.gitconfig.local"
# vimrc vundle install
echo ''
echo "Now installing vundle..."
echo ''
[[ -d ~/.vim/bundle/Vundle.vim ]] ||
git clone -q https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
# Install pathogen for vim/neovim
mkdir -p ~/.vim/autoload ~/.vim/bundle
[[ -r ~/.vim/autoload/pathogen.vim ]] ||
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
# Vim color scheme install
if ! [[ -d ~/.vim/colors/wombat/ ]]; then
echo ''
echo "Now installing vim wombat color scheme..."
echo ''
git clone -q https://github.com/sheerun/vim-wombat-scheme.git ~/.vim/colors/wombat
mv ~/.vim/colors/wombat/colors/* ~/.vim/colors/
fi
echo 'fire up vundle installation'
vim +PluginInstall +qall && echo 'vim plugins installed!'
# Bash color scheme
if ! [[ -r ~/.dircolors ]]; then
echo ''
echo "Now installing solarized dark WSL color scheme..."
echo ''
wget -q https://raw.githubusercontent.com/seebi/dircolors-solarized/master/dircolors.256dark
mv dircolors.256dark ~/.dircolors
fi
pip3 install thefuck --user
~/bin/imgcat ~/.homesick/repos/dotfiles/images/daft-punk-Approves.gif
echo
echo "More fun awaits... Now run this:"
echo ~/.homesick/repos/dotfiles/install_general.sh