-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·192 lines (168 loc) · 4.73 KB
/
setup.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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
#!/bin/zsh
# this line ensures that the $HOME/bin directory exists, and creates it if it does not.
# and same for nvim and lua and after
[[ -d "$HOME/bin" ]] || mkdir "$HOME/bin"
# check nvm if its installed if not install it
nvm --version > /dev/null 2>&1
if [ $? -ne 0 ]; then
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
fi
source ~/.zshrc
#install node using nvm to install latest version
node --version > /dev/null 2>&1
if [ $? -ne 0 ]; then
nvm install node
else
node_version=$(printf '%s\n' "16" $(node -v | cut -d 'v' -f 2) | sort -V | head -n1)
if [ $node_version != "16" ]; then
# node version is older that 16
nvm install node
fi
fi
# check if you Already have nvim and if not download it
if [[ $(uname) == "Darwin" ]]; then
cd "$HOME/bin"
FILE="nvim-macos.tar.gz"
nvim --version > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "downloading nvim..."
curl -# -OL 'https://github.com/neovim/neovim/releases/download/v0.10.1/nvim-macos.tar.gz'
tar xzf nvim-macos.tar.gz
rm $FILE
ln -s nvim-macos/bin/nvim nvim
fi
tput setaf 2;
echo "nvim [installed]"
tput init;
# does the same with clangd
FILE2="clangd-mac-14.0.3.zip"
clangd --version > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "downloading clangd..."
curl -# -OL "https://github.com/clangd/clangd/releases/download/14.0.3/$FILE2"
unzip -q $FILE2
rm $FILE2
mv clangd_* clangd_dir
ln -s clangd_dir/bin/clangd clangd
fi
tput setaf 2;
echo "clangd [installed]"
tput init;
# do the same with ripgrep
FILE3="ripgrep-13.0.0-x86_64-apple-darwin.tar.gz"
rg --version > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "downloading ripgrep"
pwd
curl -# -OL "https://github.com/BurntSushi/ripgrep/releases/download/13.0.0/ripgrep-13.0.0-x86_64-apple-darwin.tar.gz"
tar xzf $FILE3
rm $FILE3
mv ripgrep-* rg_dir
ln -s rg_dir/rg rg
fi
tput setaf 2;
echo "ripgrep [installed]"
tput init;
# downloading fd
FILE4="fd-v8.4.0-x86_64-apple-darwin.tar.gz"
fd --version > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "downloading fd"
pwd
curl -# -OL "https://github.com/sharkdp/fd/releases/download/v8.4.0/fd-v8.4.0-x86_64-apple-darwin.tar.gz"
tar xzf $FILE4
rm $FILE4
mv fd-* fd_dir
ln -s fd_dir/fd fd
fi
tput setaf 2;
echo "fd [installed]"
tput init;
# downloading lazygit
FILE5="lazygit_0.41.0_Darwin_x86_64.tar.gz"
lazygit --version > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "downloading lazygit"
curl -# -OL "https://github.com/jesseduffield/lazygit/releases/download/v0.41.0/lazygit_0.41.0_Darwin_x86_64.tar.gz"
tar xzf $FILE5
rm $FILE5
fi
tput setaf 2;
echo "LazyGit [installed]"
tput init;
else
cd "$HOME/bin"
FILE="nvim-linux64.tar.gz"
nvim --version > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "downloading nvim..."
pwd
curl -# -OL 'https://github.com/neovim/neovim/releases/download/v0.9.1/nvim-linux64.tar.gz'
tar xzf nvim-linux64.tar.gz
rm $FILE
ln -s nvim-linux64/bin/nvim nvim
fi
tput setaf 2;
echo "nvim [installed]"
tput init;
# does the same with clangd
FILE2="clangd-linux-14.0.3.zip"
clangd --version > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "downloading clangd..."
curl -# -OL "https://github.com/clangd/clangd/releases/download/14.0.3/$FILE2"
unzip -q $FILE2
rm $FILE2
mv clangd_* clangd_dir
ln -s clangd_dir/bin/clangd clangd
fi
tput setaf 2;
echo "clangd [installed]"
tput init;
# do the same with ripgrep
FILE3="ripgrep-14.1.0-x86_64-unknown-linux-musl.tar.gz"
rg --version > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "downloading ripgrep"
curl -# -OL "https://github.com/BurntSushi/ripgrep/releases/download/14.1.0/ripgrep-14.1.0-x86_64-unknown-linux-musl.tar.gz"
tar xzf $FILE3
rm $FILE3
mv ripgrep-* rg_dir
ln -s rg_dir/rg rg
fi
tput setaf 2;
echo "ripgrep [installed]"
tput init;
# downloading fd
FILE4="fd-v9.0.0-x86_64-unknown-linux-gnu.tar.gz"
fd --version > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "downloading fd"
curl -# -OL "https://github.com/sharkdp/fd/releases/download/v9.0.0/fd-v9.0.0-x86_64-unknown-linux-gnu.tar.gz"
tar xzf $FILE4
rm $FILE4
mv fd-* fd_dir
ln -s fd_dir/fd fd
fi
tput setaf 2;
echo "fd [installed]"
tput init;
# downloading lazygit
FILE5="lazygit_0.41.0_Linux_x86_64.tar.gz"
lazygit --version > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "downloading LazyGit"
curl -# -OL "https://github.com/jesseduffield/lazygit/releases/download/v0.41.0/lazygit_0.41.0_Linux_x86_64.tar.gz"
tar xzf $FILE5
rm $FILE5
fi
tput setaf 2;
echo "LazyGit [installed]"
tput init;
fi
# add bin to PATH
echo $PATH | grep -E ":$HOME/bin[ /]*:" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "PATH+=':$HOME/bin'" >> "$HOME/.zshrc"
export PATH+=':$HOME/bin'
fi