From f515a881a7901615784ae6208845e11d1acd5046 Mon Sep 17 00:00:00 2001 From: Sarina Date: Mon, 22 Jul 2024 17:03:41 +0330 Subject: [PATCH] Fix menu.sh and update.sh bugs --- core/scripts/hysteria2/update.sh | 12 ++++++------ menu.sh | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/scripts/hysteria2/update.sh b/core/scripts/hysteria2/update.sh index 2b4e40b..ec371bc 100644 --- a/core/scripts/hysteria2/update.sh +++ b/core/scripts/hysteria2/update.sh @@ -8,7 +8,7 @@ echo "Backing up the current configuration..." cp "$CONFIG_FILE" /etc/hysteria/config_backup.json if [ $? -ne 0 ]; then echo "Error: Failed to back up configuration. Aborting update." - return 1 + exit 1 fi echo "Downloading and installing the latest version of Hysteria2..." @@ -17,21 +17,21 @@ if [ $? -ne 0 ]; then echo "Error: Failed to download or install the latest version. Restoring backup configuration." mv /etc/hysteria/config_backup.json "$CONFIG_FILE" python3 "$CLI_PATH" restart-hysteria2 > /dev/null 2>&1 - return 1 + exit 1 fi echo "Restoring configuration from backup..." mv /etc/hysteria/config_backup.json "$CONFIG_FILE" if [ $? -ne 0 ]; then echo "Error: Failed to restore configuration from backup." - return 1 + exit 1 fi echo "Modifying systemd service to use config.json..." sed -i "s|/etc/hysteria/config.yaml|$CONFIG_FILE|" /etc/systemd/system/hysteria-server.service if [ $? -ne 0 ]; then echo "Error: Failed to modify systemd service." - return 1 + exit 1 fi rm /etc/hysteria/config.yaml @@ -39,9 +39,9 @@ systemctl daemon-reload >/dev/null 2>&1 python3 "$CLI_PATH" restart-hysteria2 > /dev/null 2>&1 if [ $? -ne 0 ]; then echo "Error: Failed to restart Hysteria2 service." - return 1 + exit 1 fi echo "Hysteria2 has been successfully updated." echo "" -return 0 +exit 0 diff --git a/menu.sh b/menu.sh index d734f43..76e9f6a 100644 --- a/menu.sh +++ b/menu.sh @@ -73,7 +73,7 @@ hysteria2_change_port_handler() { break fi done - python3 $CLI_PATH change-port --port "$port" + python3 $CLI_PATH change-hysteria2-port --port "$port" } # TODO check it out