Skip to content

Commit df2bb90

Browse files
committed
update install.sh
1 parent 4cbbb7a commit df2bb90

1 file changed

Lines changed: 21 additions & 18 deletions

File tree

install.sh

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,30 @@ cyan='\033[0;36m'
1010
white='\033[0;37m'
1111
rest='\033[0m'
1212

13-
# Check and install necessary packages
14-
if ! command -v wget &> /dev/null; then
15-
echo "${green}installing wget...${rest}"
13+
#!/bin/bash
14+
15+
if [ -n "$(command -v termux-chroot)" ] && [ -n "$(command -v jq)" ]; then
16+
echo "Running update & upgrade ..."
1617
pkg update -y
1718
pkg upgrade -y
18-
pkg install wget -y
19-
fi
20-
21-
if ! command -v curl &> /dev/null; then
22-
echo "${green}installing curl...${rest}"
23-
pkg install curl -y
24-
fi
25-
26-
if ! command -v unzip &> /dev/null; then
27-
echo "${green}installing unzip...${rest}"
28-
pkg install unzip -y
2919
fi
3020

31-
if ! command -v jq &> /dev/null; then
32-
echo "${green}installing jq...${rest}"
33-
pkg install jq -y
34-
fi
21+
# Check and install necessary packages
22+
install_packages() {
23+
local packages=(wget curl unzip jq)
24+
if [ -n "$(command -v pkg)" ]; then
25+
pkg install "${packages[@]}" -y
26+
elif [ -n "$(command -v apt)" ]; then
27+
sudo apt install "${packages[@]}" -y
28+
elif [ -n "$(command -v yum)" ]; then
29+
sudo yum install "${packages[@]}" -y
30+
elif [ -n "$(command -v dnf)" ]; then
31+
sudo dnf install "${packages[@]}" -y
32+
else
33+
echo -e "${red}Unsupported package manager. Please install required packages manually.${rest}"
34+
exit 1
35+
fi
36+
}
3537

3638
# Download and install Xray if not already installed
3739
if ! [ -x "$PREFIX/bin/xray" ]; then
@@ -616,6 +618,7 @@ EOF
616618
}
617619

618620
# Main menu
621+
install_packages
619622
clear
620623
echo -e "${cyan}By --> Peyman * Github.com/Ptechgithub * ${rest}"
621624
echo ""

0 commit comments

Comments
 (0)