From c1007c59ef3df2dadc6c6b0153b3f8e84dbbff73 Mon Sep 17 00:00:00 2001 From: Sarina Date: Sat, 20 Jul 2024 22:58:02 +0330 Subject: [PATCH] Isolate uninstall_hysteria --- core/scripts/hysteria2/uninstall.sh | 24 ++++++++++++++++++++++++ menu.sh | 4 +++- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 core/scripts/hysteria2/uninstall.sh diff --git a/core/scripts/hysteria2/uninstall.sh b/core/scripts/hysteria2/uninstall.sh new file mode 100644 index 0000000..88fe0d3 --- /dev/null +++ b/core/scripts/hysteria2/uninstall.sh @@ -0,0 +1,24 @@ +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 "Removing cron jobs..." +(crontab -l | grep -v "python3 /etc/hysteria/traffic.py" | crontab -) >/dev/null 2>&1 +(crontab -l | grep -v "/etc/hysteria/users/kick.sh" | crontab -) >/dev/null 2>&1 +sleep 1 +echo "Hysteria2 uninstalled!" +echo "" \ No newline at end of file diff --git a/menu.sh b/menu.sh index 24b75b2..dad8118 100644 --- a/menu.sh +++ b/menu.sh @@ -56,6 +56,7 @@ install_and_configure() { fi } +# TODO: remove # Function to update Hysteria2 update_core() { echo "Starting the update process for Hysteria2..." @@ -223,7 +224,7 @@ traffic_status() { done } - +# TODO: remove # Function to restart Hysteria2 service restart_hysteria_service() { python3 /etc/hysteria/traffic.py >/dev/null 2>&1 @@ -240,6 +241,7 @@ modify_users() { python3 "$modify_script" } +# TODO: remove # Function to uninstall Hysteria2 uninstall_hysteria() { echo "Uninstalling Hysteria2..."