-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
277 lines (218 loc) · 6.7 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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
#!/bin/bash
# Check OS
# Red HAT
if [[ -d "/etc/dnf" ]] && [[ -f "/usr/bin/dnf" ]]; then
USER_DISTRO="RED_HAT"
fi
cat /etc/os-release | grep -i "redhat" > /dev/null;
if [[ "$?" -eq 0 ]];then
USER_DISTRO="RED_HAT";
fi
# Debian
if [[ -d "/etc/apt" ]] && [[ -f "/usr/bin/apt" ]]; then
USER_DISTRO="Debian"
fi
cat /etc/os-release | grep -i "debian" > /dev/null;
if [[ "$?" -eq 0 ]];then
USER_DISTRO="Debian";
fi
# Arch
if [[ -f "/usr/bin/pacman" ]]; then
USER_DISTRO="Arch"
fi
cat /etc/os-release | grep -i "arch" > /dev/null;
if [[ "$?" -eq 0 ]];then
USER_DISTRO="Arch";
fi
case "$USER_DISTRO" in
RED_HAT)
echo "Distro Based on RED_HAT";
# Verif sudo
rpm --query sudo > /dev/null;
if [[ "$?" -eq 0 ]]
then
echo "Sudo installed"
else
echo "Sudo not installed";
echo "Type : dnf install sudo -y, then re-launch the script";
exit;
fi
#Verif git
rpm --query git > /dev/null;
if [[ "$?" -eq 0 ]]
then
echo "Git installed"
else
echo "Git not installed"
sudo dnf install git -y
fi
#Verif ZSH
rpm --query zsh > /dev/null;
if [[ "$?" -eq 0 ]]
then
echo "Zsh installed"
else
echo "Zsh not installed"
sudo dnf install zsh -y
fi
#Verif Curl
rpm --query curl > /dev/null ;
if [[ "$?" -eq 0 ]]
then
echo "Curl installed"
else
echo "Curl not installed"
sudo dnf install curl -y
fi
#Verif neofetch
rpm --query fastfetch > /dev/null ;
if [[ "$?" -eq 0 ]]
then
echo "Fastfetch installed"
else
echo "Fastfetch not installed"
sudo dnf install fastfetch -y
fi
;;
Debian)
echo "Distro Based on Debian";
#Verif sudo
apt show sudo 2> /dev/null | grep -i "APT-Manual-Installed: yes" > /dev/null
if [[ "$?" -eq 0 ]]
then
echo "Sudo installed"
else
echo "Sudo not installed";
echo "Type : apt install sudo -y";
echo "then re-launch the script";
exit;
fi
#Verif git
apt show git 2> /dev/null | grep -i "APT-Manual-Installed: yes" > /dev/null
if [[ "$?" -eq 0 ]]
then
echo "Git installed"
else
echo "Git not installed"
sudo apt install git -y
fi
#Verif ZSH
apt show zsh 2> /dev/null | grep -i "APT-Manual-Installed: yes" > /dev/null
if [[ "$?" -eq 0 ]]
then
echo "Zsh installed"
else
echo "Zsh not installed"
sudo apt install zsh -y
fi
#Verif Curl
apt show curl 2> /dev/null | grep -i "APT-Manual-Installed: yes" > /dev/null
if [[ "$?" -eq 0 ]]
then
echo "Curl installed"
else
echo "Curl not installed"
sudo apt install curl -y
fi
#Verif wget
apt show wget 2> /dev/null | grep -i "APT-Manual-Installed: yes" > /dev/null
if [[ "$?" -eq 0 ]]
then
echo "Wget installed"
else
echo "Wget not installed"
sudo apt install wget -y
fi
#Verif neofetch
apt show fastfetch 2> /dev/null | grep -i "APT-Manual-Installed: yes" > /dev/null
if [[ "$?" -eq 0 ]]
then
echo "Fastfetch installed"
else
echo "Fastfetch not installed"
wget https://github.com/fastfetch-cli/fastfetch/releases/download/2.25.0/fastfetch-linux-amd64.deb
dpkg -i fastfetch-linux-amd64.deb
rm fastfetch-linux-amd64.deb
fi
;;
Arch)
echo "Distro Based on Arch";
# Verif sudo
pacman -Q sudo > /dev/null
if [[ "$?" -eq 0 ]]
then
echo "Sudo installed"
else
echo "Sudo not installed";
echo "Type : pacman -Syu sudo";
echo "then re-launch the script";
exit;
fi
# Verif git
pacman -Q git > /dev/null
if [[ "$?" -eq 0 ]]
then
echo "Git installed"
else
echo "Git not installed"
sudo pacman -Syu git ;
fi
# Verif ZSH
pacman -Q zsh > /dev/null
if [[ "$?" -eq 0 ]]
then
echo "Zsh installed"
else
echo "Zsh not installed"
sudo pacman -Syu zsh;
fi
#Verif Curl
pacman -Q curl > /dev/null
if [[ "$?" -eq 0 ]]
then
echo "Curl installed"
else
echo "Curl not installed"
sudo pacman -Syu zsh;
fi
# Verif Fastfetch
pacman -Q fastfetch > /dev/null
if [[ "$?" -eq 0 ]]
then
echo "Fastfetch installed"
else
echo "Fastfetch not installed"
sudo pacman -Syu fastfetch;
fi
esac
# Change shell
echo "Changing default shell"
chsh -s /usr/bin/zsh ;
# Install OhMyZsh
cd ~;
curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh > install.sh && chmod +x install.sh
sh install.sh --unattended
# Install Plug-in
git clone https://github.com/zsh-users/zsh-syntax-highlighting ;
git clone https://github.com/zsh-users/zsh-completions ;
git clone https://github.com/zsh-users/zsh-autosuggestions ;
# Moove plug-in into zsh dir
mv zsh* ~/.oh-my-zsh/plugins;
# Copy personnal theme into dir
cat <<EOF >> ~/.oh-my-zsh/themes/chibraax.zsh-theme
# user, host, full path, and time/date
# on two lines for easier vgrepping
# entry in a nice long thread on the Arch Linux forums: https://bbs.archlinux.org/viewtopic.php?pid=521888#p521888
PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;31m%}%n%{\e[1;34m%}💀%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%}⚡⚡%b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%}⚡⚡%{\e[0;34m%}%B[%b%{\e[0;33m%}%!%{\e[0;34m%}%B]%b%{\e[0m%}
%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B]%{\e[0m%}%b '
RPROMPT='[%*]'
PS2=$' \e[0;34m%}%B>%{\e[0m%}%b '
EOF
# Write plug-in into .zshrc and change theme
sed -i "s/plugins=(git)/plugins=(git zsh-autosuggestions zsh-syntax-highlighting zsh-completions)/g" .zshrc ;
sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="chibraax"/g' .zshrc ;
# Config .zshrc
echo "fastfetch" >> .zshrc
rm install.sh
exec zsh -l && source .zshrc
exit 0;