From beec692075193d3810a4c673c8ddb1c50ecf1393 Mon Sep 17 00:00:00 2001 From: Return <151555003+H-Return@users.noreply.github.com> Date: Sat, 25 May 2024 00:03:43 +0330 Subject: [PATCH] Added Uninstall --- menu.sh | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/menu.sh b/menu.sh index 9194af4..ca04f75 100644 --- a/menu.sh +++ b/menu.sh @@ -96,7 +96,28 @@ traffic_status() { echo -e "Upload (TX): ${green}$(format_bytes "$tx_bytes")${NC}" echo -e "Download (RX): ${cyan}$(format_bytes "$rx_bytes")${NC}" } - +uninstall_hysteria() { + echo "Uninstalling Hysteria2..." + sleep 1 + echo "Running uninstallation script..." + bash <(curl -fsSL https://get.hy2.sh/) --remove >/dev/null 2>&1 + sleep 1 + echo "Removing Hysteria folder..." + rm -rf /etc/hysteria >/dev/null 2>&1 + sleep 1 + echo "Deleting hysteria user..." + userdel -r hysteria >/dev/null 2>&1 + sleep 1 + echo "Removing systemd service files..." + rm -f /etc/systemd/system/multi-user.target.wants/hysteria-server.service >/dev/null 2>&1 + rm -f /etc/systemd/system/multi-user.target.wants/hysteria-server@*.service >/dev/null 2>&1 + sleep 1 + echo "Reloading systemd daemon..." + systemctl daemon-reload >/dev/null 2>&1 + sleep 1 + echo "Hysteria2 uninstalled!" + echo "" +} # Main menu main_menu() { clear @@ -105,7 +126,8 @@ main_menu() { echo "2. Change Port" echo "3. Show URI" echo "4. Check Traffic Status" - echo "5. Exit" + echo "5. Uninstall Hysteria2" + echo "6. Exit" echo "================================" read -p "Enter your choice: " choice @@ -114,7 +136,8 @@ main_menu() { 2) change_port ;; 3) show_uri ;; 4) traffic_status ;; - 5) exit 0 ;; + 5) uninstall_hysteria ;; + 6) exit 0 ;; *) echo "Invalid option. Please try again." ;; esac read -p "Press any key to return to the menu..."