Skip to content

Commit e0cae39

Browse files
committed
Added automatic installation of system dependencies
1 parent be5e9f3 commit e0cae39

1 file changed

Lines changed: 80 additions & 0 deletions

File tree

installGarudaNvim.sh

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,86 @@ fi
104104
echo
105105
echo
106106

107+
# Step 1.5: Checking for System Dependencies
108+
echo "Step 1.5: Checking for System Dependencies"
109+
echo "------------------------------------------------------------------------------------------------------------------"
110+
echo "Checking for the following dependencies on your system:"
111+
echo "Node, Python, Ripgrep, Lazygit, Htop"
112+
echo "Though these are not strictly needed, it's recommended to have them for a seamless GarudaNvim experience."
113+
echo
114+
115+
dependencies=("node" "python3" "rg" "lazygit" "htop")
116+
installed_dependencies=()
117+
missing_dependencies=()
118+
119+
for dep in "${dependencies[@]}"; do
120+
if command -v "$dep" >/dev/null 2>&1; then
121+
installed_dependencies+=("$dep")
122+
else
123+
missing_dependencies+=("$dep")
124+
fi
125+
done
126+
127+
if [ ${#missing_dependencies[@]} -eq 0 ]; then
128+
echo "INFO: All dependencies are already installed."
129+
else
130+
echo "INFO: Found installed dependencies: ${installed_dependencies[*]}"
131+
echo "INFO: Missing dependencies: ${missing_dependencies[*]}"
132+
for dep in "${missing_dependencies[@]}"; do
133+
read -p "Would you like to install $dep? (y/n): " install_choice
134+
if [ "$install_choice" = "y" ]; then
135+
case "$OS" in
136+
macOS)
137+
if [ "$dep" = "node" ]; then brew install node; fi
138+
if [ "$dep" = "python3" ]; then brew install python; fi
139+
if [ "$dep" = "rg" ]; then brew install ripgrep; fi
140+
if [ "$dep" = "lazygit" ]; then brew install lazygit; fi
141+
if [ "$dep" = "htop" ]; then brew install htop; fi
142+
;;
143+
Ubuntu)
144+
sudo apt update
145+
if [ "$dep" = "node" ]; then sudo apt install -y nodejs; fi
146+
if [ "$dep" = "python3" ]; then sudo apt install -y python3; fi
147+
if [ "$dep" = "rg" ]; then sudo apt install -y ripgrep; fi
148+
if [ "$dep" = "lazygit" ]; then sudo add-apt-repository ppa:lazygit-team/release && sudo apt install -y lazygit; fi
149+
if [ "$dep" = "htop" ]; then sudo apt install -y htop; fi
150+
;;
151+
Arch)
152+
if [ "$dep" = "node" ]; then sudo pacman -Sy nodejs; fi
153+
if [ "$dep" = "python3" ]; then sudo pacman -Sy python; fi
154+
if [ "$dep" = "rg" ]; then sudo pacman -Sy ripgrep; fi
155+
if [ "$dep" = "lazygit" ]; then sudo pacman -Sy lazygit; fi
156+
if [ "$dep" = "htop" ]; then sudo pacman -Sy htop; fi
157+
;;
158+
Fedora)
159+
if [ "$dep" = "node" ]; then sudo dnf install -y nodejs; fi
160+
if [ "$dep" = "python3" ]; then sudo dnf install -y python3; fi
161+
if [ "$dep" = "rg" ]; then sudo dnf install -y ripgrep; fi
162+
if [ "$dep" = "lazygit" ]; then sudo dnf install -y lazygit; fi
163+
if [ "$dep" = "htop" ]; then sudo dnf install -y htop; fi
164+
;;
165+
RHEL)
166+
if [ "$dep" = "node" ]; then sudo yum install -y nodejs; fi
167+
if [ "$dep" = "python3" ]; then sudo yum install -y python3; fi
168+
if [ "$dep" = "rg" ]; then sudo yum install -y ripgrep; fi
169+
if [ "$dep" = "lazygit" ]; then sudo yum install -y lazygit; fi
170+
if [ "$dep" = "htop" ]; then sudo yum install -y htop; fi
171+
;;
172+
esac
173+
if command -v "$dep" >/dev/null 2>&1; then
174+
echo "INFO: $dep has been successfully installed!"
175+
else
176+
echo "WARNING: Failed to install $dep. Please install it manually if you want GarudaNvim to function smoothly."
177+
fi
178+
else
179+
echo "Please install $dep manually if you want GarudaNvim to function smoothly."
180+
fi
181+
done
182+
fi
183+
echo
184+
echo
185+
186+
107187
# Step 2: Check for existing Neovim configuration
108188
echo "Step 2: Checking for existing Neovim configuration in ~/.config/nvim"
109189
echo "------------------------------------------------------------------------------------------------------------------"

0 commit comments

Comments
 (0)