#!/bin/bash # Block specific hosts echo "127.0.0.1 goedge.cloud" | sudo tee -a /etc/hosts > /dev/null echo "127.0.0.1 goedge.cn" | sudo tee -a /etc/hosts > /dev/null echo "127.0.0.1 dl.goedge.cloud" | sudo tee -a /etc/hosts > /dev/null echo "127.0.0.1 dl.goedge.cn" | sudo tee -a /etc/hosts > /dev/null echo "127.0.0.1 global.dl.goedge.cloud" | sudo tee -a /etc/hosts > /dev/null echo "127.0.0.1 global.dl.goedge.cn" | sudo tee -a /etc/hosts > /dev/null # Display the contents of the /etc/hosts file cat /etc/hosts # Ask for the edge-node installation path read -p "Enter the path to the edge-node installation directory: " edge_node_path # Remove the existing edge-node directory sudo rm -rf "$edge_node_path" # Ensure /usr/local/goedge directory exists or create it if [ ! -d "/usr/local/goedge" ]; then sudo mkdir -p /usr/local/goedge fi # Navigate to the edge-node software directory cd /usr/local/goedge || exit # Download the edge-node software curl -L "https://dl.naixi.net/cdn/goedge/goedgecn/edge-node-linux-amd64-plus-v1.3.9.zip" --insecure -o edge-node-linux-amd64-plus.zip -C - -# # Unzip the new version unzip -o edge-node-linux-amd64-plus.zip # Create or overwrite api_node.yaml from the template if [ -d "$edge_node_path/configs" ]; then cp "$edge_node_path/configs/api_node.template.yaml" "$edge_node_path/configs/api_node.yaml" else echo "Configuration directory does not exist. Exiting." exit 1 fi # Ask the user to input the required configuration values echo "Please enter the required configuration values." read -p "Enter rpc.endpoints: " rpc_endpoints read -p "Enter nodeId: " node_id read -p "Enter secret: " secret # Insert configuration into api_node.yaml echo "rpc.endpoints: [\"$rpc_endpoints\"]" > "$edge_node_path/configs/api_node.yaml" echo "nodeId: \"$node_id\"" >> "$edge_node_path/configs/api_node.yaml" echo "secret: \"$secret\"" >> "$edge_node_path/configs/api_node.yaml" # Navigate to the specified edge-node directory cd "$edge_node_path" || exit # Stop the current edge-node processes ./bin/edge-node stop # Restart edge-node ./bin/edge-node restart # Clean up downloaded zip file rm -rf *.zip