@ -108,7 +108,7 @@ EOF
|
||||
|
||||
# Step 13: Check if the hysteria-server.service is active
|
||||
if systemctl is-active --quiet hysteria-server.service; then
|
||||
echo -e "${cyan}Hysteria2${green} has been successfully installed."
|
||||
echo -e "${cyan}Hysteria2${NC} has been successfully installed."
|
||||
else
|
||||
echo -e "${red}Error:${NC} hysteria-server.service is not active."
|
||||
exit 1
|
||||
|
||||
@ -28,10 +28,14 @@ echo "Removing cron jobs..."
|
||||
echo "Removing alias 'hys2' from .bashrc..."
|
||||
sed -i '/alias hys2=.*\/etc\/hysteria\/menu.sh/d' ~/.bashrc
|
||||
|
||||
echo "Stopping hysteria-bot.service..."
|
||||
systemctl stop hysteria-bot.service >/dev/null 2>&1
|
||||
echo "Disabling hysteria-bot.service..."
|
||||
systemctl disable hysteria-bot.service >/dev/null 2>&1
|
||||
echo "Stop/Disabling Hysteria TelegramBOT Service..."
|
||||
systemctl stop hysteria-bot.service > /dev/null 2>&1
|
||||
systemctl disable hysteria-bot.service > /dev/null 2>&1
|
||||
|
||||
echo "Stop/Disabling Singbox SubLink Service..."
|
||||
systemctl stop singbox.service > /dev/null 2>&1
|
||||
systemctl disable singbox.service > /dev/null 2>&1
|
||||
|
||||
|
||||
echo "Hysteria2 uninstalled!"
|
||||
echo ""
|
||||
|
||||
@ -10,18 +10,6 @@ install_dependencies() {
|
||||
exit 1
|
||||
fi
|
||||
echo -e "${green}Certbot installed successfully. ${NC}"
|
||||
|
||||
if [ -f /etc/hysteria/requirements.txt ]; then
|
||||
pip install -r /etc/hysteria/requirements.txt > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo -e "${red}Error: Failed to install Python dependencies. ${NC}"
|
||||
exit 1
|
||||
fi
|
||||
echo -e "${green}Python dependencies installed successfully. ${NC}"
|
||||
else
|
||||
echo -e "${red}Error: /etc/hysteria/requirements.txt not found. ${NC}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
update_env_file() {
|
||||
@ -44,7 +32,7 @@ Description=Singbox Python Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/python3 /etc/hysteria/core/scripts/singbox/singbox.py
|
||||
ExecStart=/etc/hysteria/hysteria2_venv/bin/python /etc/hysteria/core/scripts/singbox/singbox.py
|
||||
WorkingDirectory=/etc/hysteria/core/scripts/singbox
|
||||
EnvironmentFile=/etc/hysteria/core/scripts/singbox/.env
|
||||
Restart=always
|
||||
|
||||
@ -1,14 +1,6 @@
|
||||
#!/bin/bash
|
||||
source /etc/hysteria/core/scripts/utils.sh
|
||||
define_colors
|
||||
install_dependencies() {
|
||||
echo "Installing dependencies from /etc/hysteria/requirements.txt..."
|
||||
if ! pip3 install -r /etc/hysteria/requirements.txt > /dev/null 2>&1; then
|
||||
echo "Error: Failed to install dependencies. Please check the requirements file and try again."
|
||||
exit 1
|
||||
fi
|
||||
echo -e "${green}Dependencies installed successfully. ${NC}"
|
||||
}
|
||||
|
||||
update_env_file() {
|
||||
local api_token=$1
|
||||
@ -27,7 +19,7 @@ Description=Hysteria Telegram Bot
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/python3 /etc/hysteria/core/scripts/telegrambot/tbot.py
|
||||
ExecStart=/etc/hysteria/hysteria2_venv/bin/python /etc/hysteria/core/scripts/telegrambot/tbot.py
|
||||
WorkingDirectory=/etc/hysteria/core/scripts/telegrambot
|
||||
Restart=always
|
||||
User=root
|
||||
@ -47,7 +39,6 @@ start_service() {
|
||||
return
|
||||
fi
|
||||
|
||||
install_dependencies
|
||||
update_env_file "$api_token" "$admin_user_ids"
|
||||
create_service_file
|
||||
|
||||
|
||||
@ -10,11 +10,17 @@ if ! command -v jq &> /dev/null || ! command -v git &> /dev/null || ! command -v
|
||||
echo "${yellow}Necessary packages are not installed. Please wait while they are being installed..."
|
||||
sleep 3
|
||||
echo
|
||||
apt update && apt upgrade -y && apt install jq qrencode curl pwgen uuid-runtime python3 python3-pip git -y
|
||||
apt update && apt upgrade -y && apt install jq qrencode curl pwgen uuid-runtime python3 python3-pip python3-venv git -y
|
||||
fi
|
||||
|
||||
git clone https://github.com/ReturnFI/Hysteria2 /etc/hysteria
|
||||
|
||||
# Create and activate Python virtual environment
|
||||
cd /etc/hysteria
|
||||
python3 -m venv hysteria2_venv
|
||||
source /etc/hysteria/hysteria2_venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
|
||||
# Add alias 'hys2' for Hysteria2
|
||||
if ! grep -q "alias hys2='/etc/hysteria/menu.sh'" ~/.bashrc; then
|
||||
echo "alias hys2='/etc/hysteria/menu.sh'" >> ~/.bashrc
|
||||
|
||||
@ -55,5 +55,9 @@ else
|
||||
fi
|
||||
|
||||
cd /etc/hysteria
|
||||
python3 -m venv hysteria2_venv
|
||||
source /etc/hysteria/hysteria2_venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
|
||||
chmod +x menu.sh
|
||||
./menu.sh
|
||||
|
||||
Reference in New Issue
Block a user