#!/bin/bash # Function to hide or show output based on -v flag log() { if [ "$VERBOSE" = true ]; then "$@" else "$@" > /dev/null 2>&1 fi } # Function to generate a random password generate_password() { < /dev/urandom tr -dc 'A-Za-z0-9-_!@#%&*+=?' | head -c 32 } # Check for -v flag VERBOSE=false while getopts "v" flag; do case "${flag}" in v) VERBOSE=true ;; esac done # Step 1: Update package list echo "Step 1: Running apt update" log apt update -y # Step 2: Upgrade packages and install necessary tools echo "Step 2: Running apt upgrade and installing necessary tools" log apt upgrade -y log apt install curl wget iperf3 neofetch htop iptables -y # Step 3: Install Hysteria echo "Step 3: Installing Hysteria" log bash <(curl -fsSL https://get.hy2.sh/) # Step 4: Enable Hysteria service echo "Step 4: Enabling Hysteria service" log systemctl enable hysteria-server.service # Step 5: Create directory for custom systemd configuration echo "Step 5: Creating directory for custom systemd configuration" log mkdir /etc/systemd/system/hysteria-server.service.d # Step 6: Write custom CPU scheduling configuration echo "Step 6: Writing custom CPU scheduling configuration" cat <