-
Notifications
You must be signed in to change notification settings - Fork 1
/
ubuntu-bootstrap.sh
executable file
·156 lines (132 loc) · 4.45 KB
/
ubuntu-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
#!/bin/bash
# TODO: Install coc plugins using plug
set -eu
sudo apt update
sudo apt upgrade
sudo apt install -y \
git \
deja-dup \
python3 \
python \
nodejs \
npm \
python3-pydrive \
awscli \
curl \
htop \
tmux \
vim \
neovim \
tmate \
jq \
silversearcher-ag \
ripgrep \
tig \
unzip \
zip \
wget \
zsh \
fzf \
xclip \
apt-transport-https \
ca-certificates \
gnupg-agent \
software-properties-common \
s-tui \
stress \
powertop \
tlp \
firefox \
neofetch
# Snap is not compatible with WSL2
if command snap > /dev/null 2>&1; then
sudo snap install authy --beta
sudo snap install code --classic
snap install spotify
fi
if [ -d "/run/WSL" ]; then
echo "==> running WSL2 bootstrap script"
sh ./wsl2-bootstrap.sh
fi
if ! command z > /dev/null 2>&1; then
echo "==> Installing z"
git clone https://github.com/rupa/z.git
sudo cp ./z/z.sh /usr/local/bin && rm -rf ./z
fi
if ! command docker -v > /dev/null; then
echo "==> Installing Docker"
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose
sudo docker run hello-world
sudo usermod -aG docker $USER
fi
if ! command google-chrome-stable --help > /dev/null; then
echo "Installing chrome"
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add - \
&& sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' \
&& sudo apt update \
&& sudo apt install -y google-chrome-stable \
&& true
exit
fi
if ! command yarn --help > /dev/null; then
echo "Installing yarn"
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update && sudo apt install -y yarn
fi
VIM_PLUG_FILE="${HOME}/.vim/autoload/plug.vim"
if [ ! -f "${VIM_PLUG_FILE}" ]; then
echo "==> Installing vim plug"
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
echo " ==> Vim plugins will be installed on vim startup"
fi
NEOVIM_PLUG_FILE="${HOME}/.local/share/nvim/site/autoload/plug.vim"
if [ ! -f "${NEOVIM_PLUG_FILE}" ]; then
echo "==> Installing neovim plug"
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
echo "==> Neovim plugins will be installed on nvim startup"
fi
if [ ! -d "${HOME}/.oh-my-zsh" ]; then
echo "==> Installing oh-my-zsh + zsh plugins"
git clone https://github.com/ohmyzsh/ohmyzsh.git ${HOME}/.oh-my-zsh
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "${HOME}/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting"
git clone https://github.com/zsh-users/zsh-autosuggestions "${HOME}/.oh-my-zsh/custom/plugins/zsh-autosuggestions"
fi
if ! echo $SHELL | grep "zsh" > /dev/null; then
echo "==> Setting shell to zsh..."
chsh -s /usr/bin/zsh
fi
echo "==> Creating dev directories"
mkdir -p ~/Development
if [ ! -d ~/Development/dotfiles ]; then
echo "==> Setting up dotfiles"
cd ~/Development
git clone https://github.com/lucaslago/dotfiles
cd ~/Development/dotfiles
git remote set-url origin [email protected]:lucaslago/dotfiles.git
ln -sf $(pwd)/vimrc "${HOME}/.vimrc"
mkdir -p "${HOME}/.config/nvim" && ln -sf $(pwd)/init.vim "${HOME}/.config/nvim/init.vim"
ln -sf $(pwd)/zshrc "${HOME}/.zshrc"
ln -sf $(pwd)/tmux.conf "${HOME}/.tmux.conf"
ln -sf $(pwd)/gitconfig "${HOME}/.gitconfig"
mkdir -p "${HOME}/.config/coc/extensions" && ln -sf $(pwd)/coc-nvim/package.json "$HOME/.config/coc/extensions/package.json" && (cd "$HOME/.config/coc/extensions" && npm install --global-style --ignore-scripts --no-bin-links --no-package-lock --only=prod)
fi
if [ ! -d "${HOME}/.tmux/plugins" ]; then
echo " ==> Installing tmux plugins"
git clone https://github.com/tmux-plugins/tpm "${HOME}/.tmux/plugins/tpm"
${HOME}/.tmux/plugins/tpm/bin/install_plugins
fi
echo "Change terminal color? [y/N]"
read input
if [[ $input == "Y" || $input == "y" ]]; then
TERMINAL=gnome-terminal bash -c "$(curl -sLo- https://git.io/vQgMr)"
fi
echo "Done!"