1
1
#! /usr/bin/env bash
2
+ set -eo pipefail
3
+
4
+ # Global Variables
5
+ SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd -P) "
6
+ readonly SCRIPT_DIR
7
+ NERD_FONTS_VERSION=" 3.2.1"
2
8
3
9
# Initialize status variables for each installation option
4
10
gogh_status=" Install Gogh [ ]"
@@ -29,7 +35,7 @@ install_nerd_fonts() {
29
35
fi
30
36
for font in " ${fonts[@]} " ; do
31
37
zip_file=" ${font} .zip"
32
- download_url=" https://github.com/ryanoasis/nerd-fonts/releases/download/latest /${zip_file} "
38
+ download_url=" https://github.com/ryanoasis/nerd-fonts/releases/download/v ${NERD_FONTS_VERSION} /${zip_file} "
33
39
echo " Downloading $download_url "
34
40
wget " $download_url "
35
41
unzip " $zip_file " -d " $fonts_dir "
@@ -50,7 +56,7 @@ install_starship() {
50
56
curl -sS https://starship.rs/install.sh | sh
51
57
echo ' eval "$(starship init bash)"' >> ~ /.bashrc
52
58
echo " Replace starship.toml file..."
53
- cp -f ./linux/ starship/starship.toml ~ /.config/
59
+ cp -f " $SCRIPT_DIR / starship/starship.toml" ~ /.config/
54
60
if [[ $? -eq 0 ]]; then
55
61
starship_status=" Install Starship [✔]"
56
62
else
@@ -61,22 +67,41 @@ install_starship() {
61
67
# Function to install ble.sh
62
68
install_ble_sh () {
63
69
echo " Installing ble.sh prerequisites and running make..."
64
- sudo apt install gawk
70
+ sudo apt install make gawk
65
71
git clone --recursive https://github.com/akinomyoga/ble.sh.git
66
72
cd ble.sh || exit
67
- make
68
73
echo " Installing ble.sh..."
69
74
make install
70
- echo " Adding ble.sh config to .bashrc..."
71
- sed -i " 1i [[ \$ - == *i* ]] && source ~/.local/share/blesh/ble.sh --noattach" ~ /.bashrc
72
- echo " [[ ${BLE_VERSION-} ]] && ble-attach" >> ~ /.bashrc
75
+ if grep -Fxq " [[ $- == *i* ]] && source ~/.local/share/blesh/ble.sh --noattach" ~ /.bashrc; then
76
+ echo " Entry is present, skipping ~/.bashrc modification..."
77
+ else
78
+ echo " Adding ble.sh source config to .bashrc..."
79
+ sed -i " 1i [[ \$ - == *i* ]] && source ~/.local/share/blesh/ble.sh --noattach" ~ /.bashrc
80
+ echo " [[ \$ {BLE_VERSION-} ]] && ble-attach" >> ~ /.bashrc
81
+ fi
82
+ if grep -Fxq " [[ ${BLE_VERSION-} ]] && ble-attach" ~ /.bashrc; then
83
+ echo " Entry is present, skipping ~/.bashrc modification..."
84
+ else
85
+ echo " Adding ble.sh attach config to .bashrc..."
86
+ echo " [[ \$ {BLE_VERSION-} ]] && ble-attach" >> ~ /.bashrc
87
+ fi
73
88
if [[ $? -eq 0 ]]; then
74
89
ble_sh_status=" Install ble.sh [✔]"
90
+ rm -rf ble.sh
75
91
else
76
92
ble_sh_status=" Install ble.sh [✘]"
93
+ rm -rf ble.sh
77
94
fi
78
95
}
79
96
97
+ # Function to install all
98
+ install_all () {
99
+ install_gogh
100
+ install_nerd_fonts
101
+ install_starship
102
+ install_ble_sh
103
+ }
104
+
80
105
# Main function to display the menu
81
106
main_menu () {
82
107
echo "
0 commit comments