-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_packages.sh
49 lines (41 loc) · 1.22 KB
/
install_packages.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
#!/bin/bash
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
RED="\033[31m"
NC='\033[0m'
if [[ "$(uname)" == "Darwin" ]]; then
echo -e "${RED}✗${NC} This script is not supported on Darwin."
exit 1
fi
echo -e "\n${YELLOW}==== Installing Additional Tools ====${NC}"
echo "Checking if package manager is available..."
# Check if another apt process is running
if pgrep -f apt > /dev/null || pgrep -f dpkg > /dev/null; then
echo -e "${RED}✗${NC} Package manager is currently busy."
echo "Please try again later or check running processes with:"
echo "ps aux | grep -E 'apt|dpkg'"
exit 1
fi
echo "Updating package lists..."
if ! sudo apt-get update; then
echo -e "${RED}✗${NC} Failed to update package lists. Continuing anyway..."
fi
apt_packages=(
git
wget
vim
)
echo "Installing packages..."
for package in "${apt_packages[@]}"; do
if ! dpkg -s "$package" &>/dev/null; then
echo "Installing $package..."
if ! sudo apt-get install -y "$package"; then
echo -e "${RED}✗${NC} Failed to install $package"
else
echo -e "${GREEN}✓${NC} Installed $package"
fi
else
echo -e "${GREEN}✓${NC} $package already installed"
fi
done
echo -e "\n${GREEN}✓${NC} Additional tools installation complete!"