-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·122 lines (99 loc) · 3.58 KB
/
install.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
#!/bin/bash
install_asdf() {
rm -rf ~/.asdf
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.12.0
if ! grep -q "asdf-vm" ~/.bashrc; then
{
echo -e "\n# asdf-vm"
echo ". $HOME/.asdf/asdf.sh"
echo ". $HOME/.asdf/completions/asdf.bash"
} >> ~/.bashrc
fi
source "$HOME/.asdf/asdf.sh"
source "$HOME/.asdf/completions/asdf.bash"
}
check_and_install_requirements() {
echo "Checking requirements..."
if which whiptail git asdf > /dev/null; then
echo "OK"
return
fi
echo "This script needs whiptail, git and asdf to work. So, these will be installed."
echo "Installing whiptail, git and asdf..."
sudo apt-get update && sudo apt-get -y install whiptail git && install_asdf
}
skip() {
if ! which "$1" > /dev/null; then
echo "Installing $1..."
return 1
fi
if (whiptail --title "$1" --yesno "$1 is already installed. Do you want to reinstall it?" 8 78); then
echo "Installing $1..."
return 1
else
echo "Skipping $1..."
return 0
fi
}
install_zsh() {
skip zsh && return
sudo apt-get update && sudo apt-get -y install zsh
rm -rf ~/.oh-my-zsh ~/.zshrc ~/.fzf
git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf && ~/.fzf/install
wget -O ~/.zshrc https://raw.githubusercontent.com/MamesPalmero/dotfiles/master/zsh/zshrc
chsh -s "$(which zsh)"
zsh
}
install_tmux() {
skip tmux && return
sudo apt-get update && sudo apt-get -y install xclip tmux
wget -O ~/.tmux.conf https://raw.githubusercontent.com/MamesPalmero/dotfiles/master/tmux/tmux.conf
}
install_vim() {
skip vim && return
rm -rf ~/.vim
sudo apt-get update && sudo apt-get -y install vim-gnome silversearcher-ag
mkdir -p ~/.vim/_temp ~/.vim/_backup
wget -O ~/.vimrc https://raw.githubusercontent.com/MamesPalmero/dotfiles/master/vim/vimrc
vim +PlugInstall +qa
}
install_nvim() {
skip nvim && return
rm -rf ~/.config/nvim
rm -rf ~/.local/share/nvim
sudo rm -rf /tmp/nvim
#Nodejs support
sudo apt-get update
sudo apt-get -y install curl
asdf plugin-add nodejs
asdf install nodejs 18.16.1
asdf global nodejs 18.16.1
sudo apt-get -y install silversearcher-ag xclip
sudo wget -O /tmp/nvim-linux64.tar.gz https://github.com/neovim/neovim/releases/download/v0.9.1/nvim-linux64.tar.gz
sudo tar fxzv /tmp/nvim-linux64.tar.gz -C /opt
sudo mv /opt/nvim-linux64 /opt/nvim
sudo ln -s /opt/nvim/bin/nvim /usr/bin/nvim
mkdir -p ~/.config/nvim/_temp ~/.config/nvim/_backup
wget -O ~/.config/nvim/init.vim \
https://raw.githubusercontent.com/MamesPalmero/dotfiles/master/nvim/init.vim
wget -O ~/.config/nvim/coc-settings.json \
https://raw.githubusercontent.com/MamesPalmero/dotfiles/master/nvim/coc-settings.json
curl https://codeload.github.com/MamesPalmero/dotfiles/tar.gz/master | \
tar -xz --directory ~/.config/nvim --strip=2 dotfiles-master/nvim/after
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
nvim -i NONE -c "PlugInstall" -c "qa"
}
check_and_install_requirements
tools=$(
whiptail --title "My environment" --notags \
--checklist "Choose what you want to install" 20 78 5 \
"install_zsh" "zsh -> Shell" ON \
"install_tmux" "tmux -> Terminal multiplexer" ON \
"install_vim" "vim -> Text editor" OFF \
"install_nvim" "nvim -> Text editor" ON \
3>&1 1>&2 2>&3
)
for tool in $tools; do eval "$tool"; done