Fix menu.sh and update.sh bugs

This commit is contained in:
Sarina
2024-07-22 17:03:41 +03:30
parent 061a85a167
commit f515a881a7
2 changed files with 7 additions and 7 deletions

View File

@ -8,7 +8,7 @@ echo "Backing up the current configuration..."
cp "$CONFIG_FILE" /etc/hysteria/config_backup.json cp "$CONFIG_FILE" /etc/hysteria/config_backup.json
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Error: Failed to back up configuration. Aborting update." echo "Error: Failed to back up configuration. Aborting update."
return 1 exit 1
fi fi
echo "Downloading and installing the latest version of Hysteria2..." 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." echo "Error: Failed to download or install the latest version. Restoring backup configuration."
mv /etc/hysteria/config_backup.json "$CONFIG_FILE" mv /etc/hysteria/config_backup.json "$CONFIG_FILE"
python3 "$CLI_PATH" restart-hysteria2 > /dev/null 2>&1 python3 "$CLI_PATH" restart-hysteria2 > /dev/null 2>&1
return 1 exit 1
fi fi
echo "Restoring configuration from backup..." echo "Restoring configuration from backup..."
mv /etc/hysteria/config_backup.json "$CONFIG_FILE" mv /etc/hysteria/config_backup.json "$CONFIG_FILE"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Error: Failed to restore configuration from backup." echo "Error: Failed to restore configuration from backup."
return 1 exit 1
fi fi
echo "Modifying systemd service to use config.json..." echo "Modifying systemd service to use config.json..."
sed -i "s|/etc/hysteria/config.yaml|$CONFIG_FILE|" /etc/systemd/system/hysteria-server.service sed -i "s|/etc/hysteria/config.yaml|$CONFIG_FILE|" /etc/systemd/system/hysteria-server.service
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Error: Failed to modify systemd service." echo "Error: Failed to modify systemd service."
return 1 exit 1
fi fi
rm /etc/hysteria/config.yaml 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 python3 "$CLI_PATH" restart-hysteria2 > /dev/null 2>&1
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Error: Failed to restart Hysteria2 service." echo "Error: Failed to restart Hysteria2 service."
return 1 exit 1
fi fi
echo "Hysteria2 has been successfully updated." echo "Hysteria2 has been successfully updated."
echo "" echo ""
return 0 exit 0

View File

@ -73,7 +73,7 @@ hysteria2_change_port_handler() {
break break
fi fi
done done
python3 $CLI_PATH change-port --port "$port" python3 $CLI_PATH change-hysteria2-port --port "$port"
} }
# TODO check it out # TODO check it out