Isolate install_warp
This commit is contained in:
@ -0,0 +1,18 @@
|
|||||||
|
# Check if wg-quick@wgcf.service is active
|
||||||
|
if systemctl is-active --quiet wg-quick@wgcf.service; then
|
||||||
|
echo "WARP is already active. Skipping installation and configuration update."
|
||||||
|
else
|
||||||
|
echo "Installing WARP..."
|
||||||
|
bash <(curl -fsSL git.io/warp.sh) wgx
|
||||||
|
|
||||||
|
# Check if the config file exists
|
||||||
|
if [ -f "/etc/hysteria/config.json" ]; then
|
||||||
|
# Add the outbound configuration to the config.json file
|
||||||
|
jq '.outbounds += [{"name": "warps", "type": "direct", "direct": {"mode": 4, "bindDevice": "wgcf"}}]' /etc/hysteria/config.json > /etc/hysteria/config_temp.json && mv /etc/hysteria/config_temp.json /etc/hysteria/config.json
|
||||||
|
# Restart the hysteria-server service
|
||||||
|
restart_hysteria_service >/dev/null 2>&1
|
||||||
|
echo "WARP installed and outbound added to config.json."
|
||||||
|
else
|
||||||
|
echo "${red}Error:${NC} Config file /etc/hysteria/config.json not found."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
23
menu.sh
23
menu.sh
@ -241,29 +241,6 @@ modify_users() {
|
|||||||
python3 "$modify_script"
|
python3 "$modify_script"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to install WARP and update config.json
|
|
||||||
install_warp() {
|
|
||||||
# Check if wg-quick@wgcf.service is active
|
|
||||||
if systemctl is-active --quiet wg-quick@wgcf.service; then
|
|
||||||
echo "WARP is already active. Skipping installation and configuration update."
|
|
||||||
else
|
|
||||||
echo "Installing WARP..."
|
|
||||||
bash <(curl -fsSL git.io/warp.sh) wgx
|
|
||||||
|
|
||||||
# Check if the config file exists
|
|
||||||
if [ -f "/etc/hysteria/config.json" ]; then
|
|
||||||
# Add the outbound configuration to the config.json file
|
|
||||||
jq '.outbounds += [{"name": "warps", "type": "direct", "direct": {"mode": 4, "bindDevice": "wgcf"}}]' /etc/hysteria/config.json > /etc/hysteria/config_temp.json && mv /etc/hysteria/config_temp.json /etc/hysteria/config.json
|
|
||||||
# Restart the hysteria-server service
|
|
||||||
restart_hysteria_service >/dev/null 2>&1
|
|
||||||
echo "WARP installed and outbound added to config.json."
|
|
||||||
else
|
|
||||||
echo "${red}Error:${NC} Config file /etc/hysteria/config.json not found."
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Function to configure WARP
|
# Function to configure WARP
|
||||||
configure_warp() {
|
configure_warp() {
|
||||||
# Check if wg-quick@wgcf.service is active
|
# Check if wg-quick@wgcf.service is active
|
||||||
|
|||||||
Reference in New Issue
Block a user