Update Packages
This commit is contained in:
18
install.sh
18
install.sh
@ -1,27 +1,27 @@
|
|||||||
# Ensure necessary packages are installed
|
#!/bin/bash
|
||||||
# Check if the script is being run by the root user
|
|
||||||
if [ "$(id -u)" -ne 0 ]; then
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
echo "This script must be run as root."
|
echo "This script must be run as root."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
clear
|
clear
|
||||||
if ! command -v jq &> /dev/null || ! command -v git &> /dev/null || ! command -v qrencode &> /dev/null || ! command -v curl &> /dev/null; then
|
REQUIRED_PACKAGES="jq qrencode curl pwgen uuid-runtime python3 python3-pip python3-venv git bc zip"
|
||||||
echo "${yellow}Necessary packages are not installed. Please wait while they are being installed..."
|
|
||||||
sleep 3
|
MISSING_PACKAGES=$(dpkg-query -W -f='${Package}\n' $REQUIRED_PACKAGES 2>&1 | grep -v "ok installed")
|
||||||
echo
|
if [ -n "$MISSING_PACKAGES" ]; then
|
||||||
apt update && apt upgrade -y && apt install jq qrencode curl pwgen uuid-runtime python3 python3-pip python3-venv git bc zip -y
|
echo "The following packages are missing and will be installed: $MISSING_PACKAGES"
|
||||||
|
apt update
|
||||||
|
apt install -y $MISSING_PACKAGES
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git clone https://github.com/ReturnFI/Hysteria2 /etc/hysteria
|
git clone https://github.com/ReturnFI/Hysteria2 /etc/hysteria
|
||||||
|
|
||||||
# Create and activate Python virtual environment
|
|
||||||
cd /etc/hysteria
|
cd /etc/hysteria
|
||||||
python3 -m venv hysteria2_venv
|
python3 -m venv hysteria2_venv
|
||||||
source /etc/hysteria/hysteria2_venv/bin/activate
|
source /etc/hysteria/hysteria2_venv/bin/activate
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
|
|
||||||
# Add alias 'hys2' for Hysteria2
|
|
||||||
if ! grep -q "alias hys2='source /etc/hysteria/hysteria2_venv/bin/activate && /etc/hysteria/menu.sh'" ~/.bashrc; then
|
if ! grep -q "alias hys2='source /etc/hysteria/hysteria2_venv/bin/activate && /etc/hysteria/menu.sh'" ~/.bashrc; then
|
||||||
echo "alias hys2='source /etc/hysteria/hysteria2_venv/bin/activate && /etc/hysteria/menu.sh'" >> ~/.bashrc
|
echo "alias hys2='source /etc/hysteria/hysteria2_venv/bin/activate && /etc/hysteria/menu.sh'" >> ~/.bashrc
|
||||||
source ~/.bashrc
|
source ~/.bashrc
|
||||||
|
|||||||
Reference in New Issue
Block a user