mirror of
https://gitlab.com/fscarmen/warp.git
synced 2026-06-15 03:25:42 +08:00
v3.2.1 Remove OS version checks to support rolling releases.
This commit is contained in:
@@ -22,16 +22,18 @@
|
||||
* * *
|
||||
|
||||
## 更新信息
|
||||
2026.02.22 mehu.sh v3.2.1 / warp-go.sh v1.3.1 1. 移除系统版本号判断,以支持滚动发行版; 2. cloudflare.now.cc -> cloudflare.nyc.mn
|
||||
|
||||
2026.01.02 mehu.sh v3.2.0 / warp-go.sh v1.3.0 1. 账户管理优化: 顺应 Cloudflare 对 WARP 账户政策的调整,移除了已过时的 WARP+ 和 Teams 账户类型,精简了安装流程及账户升级功能(受影响命令:warp a); 2. 修复卸载 Bug: 修正了 Linux Client 在 Proxy 模式下,卸载程序后误操作路由规则而导致的网络故障问题; 3. 性能提升: 引入自建 IP API 替代第三方接口,显著提升了 IP 信息获取和脚本初始化的速度; 4. 脚本清理: 移除了部分不再使用的冗余脚本提示语及过时代码块,使输出界面更加简洁; 5. 刷 IP 逻辑: 将 Netflix 解锁检测的默认首选项从 IPv4 调整为 IPv6
|
||||
|
||||
2025.09.10 menu.sh v3.1.8 增强脚本对 Arch Linux 及 EndeavourOS 系统的兼容性
|
||||
|
||||
2025.08.24 menu.sh v3.1.7 1. 适配 Ubuntu 24.04 及以上版本安装 Warp,感谢网友 [Michaol] 提供的解决方案; 2. 适配 Debian 13 安装 Client,感谢用户 [ainp] 的反馈
|
||||
|
||||
<details>
|
||||
<summary>历史更新(点击展开或收起)</summary>
|
||||
<br>
|
||||
|
||||
>2025.08.24 menu.sh v3.1.7 1. 适配 Ubuntu 24.04 及以上版本安装 Warp,感谢网友 [Michaol] 提供的解决方案; 2. 适配 Debian 13 安装 Client,感谢用户 [ainp] 的反馈
|
||||
>
|
||||
>2025.08.11 menu.sh v3.1.6 / warp-go.sh v1.2.4 删除最优 Endpoint 功能以适应官方调整
|
||||
>
|
||||
>2025.03.24 menu.sh v3.1.5 1. 处理了 Client 的 Warp 模式(网络接口)重启后不工作的问题; 2. 修正 Team IPv6 判断的正则
|
||||
|
||||
+6
-4
@@ -22,16 +22,18 @@ English | [中文](README.md)
|
||||
* * *
|
||||
|
||||
## Update Information
|
||||
2026.02.22 mehu.sh v3.2.1 / warp-go.sh v1.3.1 1. Remove OS version checks to support rolling releases; 2. cloudflare.now.cc -> cloudflare.nyc.mn
|
||||
|
||||
2026.01.02 mehu.sh v3.2.0 / warp-go.sh v1.3.0 1. Account: Remove deprecated WARP+ and Teams account types from installation and upgrade processes (warp a) following Cloudflare's adjustments; 2. Bug Fix: Resolve networking breakdown by correcting routing rule handling during Linux Client removal in proxy mode; 3. Performance: Implement self-hosted IP API to significantly improve IP information retrieval speed; 4. Cleanup: Remove obsolete script prompts and redundant UI messages; 5. IP-Brushing Logic: Adjust default Netflix unlock preference from IPv4 to IPv6
|
||||
|
||||
2025.09.10 menu.sh v3.1.8 Enhance the script's compatibility with Arch Linux and EndeavourOS systems.
|
||||
|
||||
2025.08.24 menu.sh v3.1.7 1. Added support for installing Warp on Ubuntu 24.04 and later versions. Thanks to the solution provided by community member [Michaol]; 2. Added support for Client installation on Debian 13. Thanks to the feedback from user [ainp]
|
||||
|
||||
<details>
|
||||
<summary>Historical Updates (click to expand or collapse)</summary>
|
||||
<br>
|
||||
|
||||
>2025.09.10 menu.sh v3.1.8 Enhance the script's compatibility with Arch Linux and EndeavourOS systems.
|
||||
>
|
||||
>2025.08.24 menu.sh v3.1.7 1. Added support for installing Warp on Ubuntu 24.04 and later versions. Thanks to the solution provided by community member [Michaol]; 2. Added support for Client installation on Debian 13. Thanks to the feedback from user [ainp]
|
||||
>
|
||||
>2025.08.11 menu.sh v3.1.6 / warp-go.sh v1.2.4 Remove best endpoint feature to adapt to official adjustments;
|
||||
>
|
||||
>2025.03.24 menu.sh v3.1.5 1. Client's Warp mode (network interface) has been fixed to deal with the problem that it does not work after reboot; 2. Fixed the regularity of Team IPv6 judgment;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 当前脚本版本号
|
||||
VERSION='3.2.0'
|
||||
VERSION='3.2.1'
|
||||
|
||||
# 环境变量用于在Debian或Ubuntu操作系统中设置非交互式(noninteractive)安装模式
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
@@ -13,8 +13,8 @@ trap cleanup_resources EXIT INT TERM
|
||||
|
||||
E[0]="\n Language:\n 1. English (default) \n 2. 简体中文"
|
||||
C[0]="${E[0]}"
|
||||
E[1]="1. Account: Remove deprecated WARP+ and Teams account types from installation and upgrade processes (warp a) following Cloudflare's adjustments; 2. Bug Fix: Resolve networking breakdown by correcting routing rule handling during Linux Client removal in proxy mode; 3. Performance: Implement self-hosted IP API to significantly improve IP information retrieval speed; 4. Cleanup: Remove obsolete script prompts and redundant UI messages."
|
||||
C[1]="1. 账户管理优化: 顺应 Cloudflare 对 WARP 账户政策的调整,移除了已过时的 WARP+ 和 Teams 账户类型,精简了安装流程及账户升级功能(受影响命令:warp a); 2. 修复卸载 Bug: 修正了 Linux Client 在 Proxy 模式下,卸载程序后误操作路由规则而导致的网络故障问题; 3. 性能提升: 引入自建 IP API 替代第三方接口,显著提升了 IP 信息获取和脚本初始化的速度; 4. 脚本清理: 移除了部分不再使用的冗余脚本提示语及过时代码块,使输出界面更加简洁"
|
||||
E[1]="1. Remove OS version checks to support rolling releases; 2. cloudflare.now.cc -> cloudflare.nyc.mn"
|
||||
C[1]="1. 移除系统版本号判断,以支持滚动发行版; 2. cloudflare.now.cc -> cloudflare.nyc.mn"
|
||||
E[2]="The script must be run as root, you can enter sudo -i and then download and run again. Feedback: [https://github.com/fscarmen/warp-sh/issues]"
|
||||
C[2]="必须以root方式运行脚本,可以输入 sudo -i 后重新下载运行,问题反馈:[https://github.com/fscarmen/warp-sh/issues]"
|
||||
E[3]="The TUN module is not loaded. You should turn it on in the control panel. Ask the supplier for more help. Feedback: [https://github.com/fscarmen/warp-sh/issues]"
|
||||
@@ -63,8 +63,8 @@ E[24]="Client is on"
|
||||
C[24]="Client 已开启"
|
||||
E[25]="Port change to \$PORT succeeded."
|
||||
C[25]="端口成功更换至 \$PORT"
|
||||
E[26]="Curren operating system is \$SYS.\\\n The system lower than \$SYSTEM \${MAJOR[int]} is not supported. Feedback: [https://github.com/fscarmen/warp-sh/issues]"
|
||||
C[26]="当前操作是 \$SYS\\\n 不支持 \$SYSTEM \${MAJOR[int]} 以下系统,问题反馈:[https://github.com/fscarmen/warp-sh/issues]"
|
||||
E[26]="\${MODE_BEFORE} ---\> \${MODE_AFTER}, Confirm press [y] :"
|
||||
C[26]="\${MODE_BEFORE} ---\> \${MODE_AFTER}, 确认请按 [y] :"
|
||||
E[27]="Local Socks5"
|
||||
C[27]="本地 Socks5"
|
||||
E[28]="Congratulations! WARP\$TYPE is turned on."
|
||||
@@ -291,8 +291,6 @@ E[138]="\${WIREGUARD_BEFORE} ---\> \${WIREGUARD_AFTER}. Confirm press [y] :"
|
||||
C[138]="\${WIREGUARD_BEFORE} ---\> \${WIREGUARD_AFTER}, 确认请按 [y] :"
|
||||
E[139]="Working mode:\n 1. Global (default)\n 2. Non-global"
|
||||
C[139]="工作模式:\n 1. 全局 (默认)\n 2. 非全局"
|
||||
E[140]="\${MODE_BEFORE} ---\> \${MODE_AFTER}, Confirm press [y] :"
|
||||
C[140]="\${MODE_BEFORE} ---\> \${MODE_AFTER}, 确认请按 [y] :"
|
||||
|
||||
# 自定义字体彩色,read 函数
|
||||
warning() { echo -e "\033[31m\033[01m$*\033[0m"; } # 红色
|
||||
@@ -359,27 +357,34 @@ check_virt() {
|
||||
# 多方式判断操作系统,试到有值为止。只支持 Debian 10/11、Ubuntu 18.04/20.04 或 CentOS 7/8 ,如非上述操作系统,退出脚本
|
||||
check_operating_system() {
|
||||
if [ -s /etc/os-release ]; then
|
||||
SYS="$(grep -i pretty_name /etc/os-release | cut -d \" -f2)"
|
||||
SYS="$(awk -F= '/^PRETTY_NAME=/{gsub(/"/,"",$2);print $2;exit}' /etc/os-release)"
|
||||
elif [ -x "$(type -p hostnamectl)" ]; then
|
||||
SYS="$(hostnamectl | grep -i system | cut -d : -f2)"
|
||||
SYS="$(awk -F: '/System/{sub(/^[ \t]+/,"",$2);print $2;exit}' < <(hostnamectl))"
|
||||
elif [ -x "$(type -p lsb_release)" ]; then
|
||||
SYS="$(lsb_release -sd)"
|
||||
elif [ -s /etc/lsb-release ]; then
|
||||
SYS="$(grep -i description /etc/lsb-release | cut -d \" -f2)"
|
||||
SYS="$(awk -F= '/^DISTRIB_DESCRIPTION=/{gsub(/"/,"",$2);print $2;exit}' /etc/lsb-release)"
|
||||
elif [ -s /etc/redhat-release ]; then
|
||||
SYS="$(grep . /etc/redhat-release)"
|
||||
SYS="$(awk '{print;exit}' /etc/redhat-release)"
|
||||
elif [ -s /etc/issue ]; then
|
||||
SYS="$(grep . /etc/issue | cut -d '\' -f1 | sed '/^[ ]*$/d')"
|
||||
SYS="$(awk '{print;exit}' /etc/issue)"
|
||||
fi
|
||||
|
||||
# 自定义 Alpine 系统若干函数
|
||||
alpine_warp_restart() { wg-quick down warp >/dev/null 2>&1; wg-quick up warp >/dev/null 2>&1; }
|
||||
alpine_warp_enable() { echo -e "/usr/bin/tun.sh\nwg-quick up warp" > /etc/local.d/warp.start; chmod +x /etc/local.d/warp.start; rc-update add local; wg-quick up warp >/dev/null 2>&1; }
|
||||
alpine_warp_restart() {
|
||||
wg-quick down warp >/dev/null 2>&1
|
||||
wg-quick up warp >/dev/null 2>&1
|
||||
}
|
||||
|
||||
alpine_warp_enable() {
|
||||
echo -e "/usr/bin/tun.sh\nwg-quick up warp" > /etc/local.d/warp.start
|
||||
chmod +x /etc/local.d/warp.start
|
||||
rc-update add local
|
||||
wg-quick up warp >/dev/null 2>&1
|
||||
}
|
||||
|
||||
REGEX=("debian" "ubuntu" "centos|red hat|kernel|alma|rocky" "alpine" "arch linux|endeavouros" "fedora")
|
||||
RELEASE=("Debian" "Ubuntu" "CentOS" "Alpine" "Arch" "Fedora")
|
||||
EXCLUDE=("---")
|
||||
MAJOR=("9" "16" "7" "" "" "37")
|
||||
PACKAGE_UPDATE=("apt -y update" "apt -y update" "yum -y update --skip-broken" "apk update -f" "pacman -Sy" "dnf -y update")
|
||||
PACKAGE_INSTALL=("apt -y install" "apt -y install" "yum -y install" "apk add -f" "pacman -S --noconfirm" "dnf -y install")
|
||||
PACKAGE_UNINSTALL=("apt -y autoremove" "apt -y autoremove" "yum -y autoremove" "apk del -f" "pacman -Rcnsu --noconfirm" "dnf -y autoremove")
|
||||
@@ -397,11 +402,7 @@ check_operating_system() {
|
||||
fi
|
||||
|
||||
# 判断主 Linux 版本
|
||||
MAJOR_VERSION=$(sed "s/[^0-9.]//g" <<< "$SYS" | cut -d. -f1)
|
||||
|
||||
# 先排除 EXCLUDE 里包括的特定系统,其他系统需要作大发行版本的比较
|
||||
for ex in "${EXCLUDE[@]}"; do [[ ! "${SYS,,}" =~ $ex ]]; done &&
|
||||
[[ "$MAJOR_VERSION" -lt "${MAJOR[int]}" ]] && error " $(text 26) "
|
||||
MAJOR_VERSION=$(awk '{gsub(/[^0-9.]/,"");print int($0)}' <<< "$SYS")
|
||||
}
|
||||
|
||||
# 安装系统依赖及定义 ping 指令
|
||||
@@ -469,8 +470,8 @@ warp_api(){
|
||||
fi
|
||||
|
||||
case "$RUN" in
|
||||
register )
|
||||
local ACCOUNT=$(curl --retry 50 --retry-delay 1 --max-time 2 --silent --location --fail "https://warp.cloudflare.now.cc/?run=register")
|
||||
register )
|
||||
local ACCOUNT=$(curl --retry 50 --retry-delay 1 --max-time 2 --silent --location --fail "https://warp.cloudflare.nyc.mn/?run=register")
|
||||
grep -q '"id"' <<< "$ACCOUNT" && echo "$ACCOUNT" ||
|
||||
echo '{
|
||||
"id": "b0fe9b24-3396-486e-a12d-c194dbbb7bfb",
|
||||
@@ -591,10 +592,10 @@ ip_info() {
|
||||
# 对于查 socks5 代理的 IP,需要用另一个 IP api
|
||||
if grep -q 'socks5' <<< "$INTERFACE_SOCK5"; then
|
||||
local WAN=$(curl -s -A a --retry 2 $INTERFACE_SOCK5 https://api-ipv${CHECK_46}.ip.sb/ip) &&
|
||||
local IP_JSON=$(curl -sm2 --retry 2 https://ip.cloudflare.now.cc/${WAN}${IS_CHINESE}) &&
|
||||
local IP_JSON=$(curl -sm2 --retry 2 https://ip.cloudflare.nyc.mn/${WAN}${IS_CHINESE}) &&
|
||||
grep -qi '"isp".*Cloudflare' <<< "$IP_JSON" && local IP_TRACE='on'
|
||||
else
|
||||
local IP_JSON=$(curl --retry 2 -ksm2 $INTERFACE_SOCK5 -$CHECK_46 https://ip.cloudflare.now.cc${IS_CHINESE}) &&
|
||||
local IP_JSON=$(curl --retry 2 -ksm2 $INTERFACE_SOCK5 -$CHECK_46 https://ip.cloudflare.nyc.mn${IS_CHINESE}) &&
|
||||
local IP_TRACE=$(awk -F '"' '/"warp"/{print $4}' <<< "$IP_JSON") &&
|
||||
local WAN=$(awk -F '"' '/"ip"/{print $4}' <<< "$IP_JSON")
|
||||
fi
|
||||
@@ -1412,7 +1413,7 @@ working_mode_switch() {
|
||||
MODE_BEFORE="$(text 96)"; MODE_AFTER="$(text 95)"
|
||||
fi
|
||||
|
||||
reading "\n $(text 140) " CONFIRM_MODE_CHANGE
|
||||
reading "\n $(text 26) " CONFIRM_MODE_CHANGE
|
||||
if [ "${CONFIRM_MODE_CHANGE,,}" = 'y' ]; then
|
||||
wg-quick down warp >/dev/null 2>&1
|
||||
[ "$MODE_AFTER" = "$(text 96)" ] && sed -i "/Table/s/#//g;/NonGlobal/s/#//g" /etc/wireguard/warp.conf || sed -i "s/^Table/#Table/g; /NonGlobal/s/^/#&/g" /etc/wireguard/warp.conf
|
||||
|
||||
+29
-34
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 当前脚本版本号和新增功能
|
||||
VERSION='1.3.0'
|
||||
VERSION='1.3.1'
|
||||
|
||||
# 环境变量用于在Debian或Ubuntu操作系统中设置非交互式(noninteractive)安装模式
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
@@ -13,8 +13,8 @@ trap cleanup_resources EXIT INT TERM
|
||||
|
||||
E[0]="Language:\n 1.English (default) \n 2.简体中文"
|
||||
C[0]="${E[0]}"
|
||||
E[1]="1. Account: Remove deprecated WARP+ and Teams account types from installation and upgrade processes (warp-go a) following Cloudflare's adjustments; 2. IP-Brushing Logic: Adjust default Netflix unlock preference from IPv4 to IPv6; 3. Performance: Implement self-hosted IP API to significantly improve IP information retrieval speed; 4. Cleanup: Remove obsolete script prompts and redundant UI messages."
|
||||
C[2]="1. 账户管理优化: 顺应 Cloudflare 对 WARP 账户政策的调整,移除了已过时的 WARP+ 和 Teams 账户类型,精简了安装流程及账户升级功能(受影响命令:warp-go a); 2. 刷 IP 逻辑: 将 Netflix 解锁检测的默认首选项从 IPv4 调整为 IPv6; 3. 性能提升: 引入自建 IP API 替代第三方接口,显著提升了 IP 信息获取和脚本初始化的速度; 4. 脚本清理: 移除了部分不再使用的冗余脚本提示语及过时代码块,使输出界面更加简洁"
|
||||
E[1]="1. Remove OS version checks to support rolling releases; 2. cloudflare.now.cc -> cloudflare.nyc.mn"
|
||||
C[1]="1. 移除系统版本号判断,以支持滚动发行版; 2. cloudflare.now.cc -> cloudflare.nyc.mn"
|
||||
E[2]="warp-go h (help)\n warp-go o (temporary warp-go switch)\n warp-go u (uninstall WARP web interface and warp-go)\n warp-go v (sync script to latest version)\n warp-go i (replace IP with Netflix support)\n warp-go 4/6 ( WARP IPv4/IPv6 single-stack)\n warp-go d (WARP dual-stack)\n warp-go n (WARP IPv4 non-global)\n warp-go g (WARP global/non-global switching)\n warp-go e (output wireguard and sing-box configuration file)\n warp-go s 4/6/d (Set stack proiority: IPv4 / IPv6 / VPS default)\n"
|
||||
C[2]="warp-go h (帮助)\n warp-go o (临时 warp-go 开关)\n warp-go u (卸载 WARP 网络接口和 warp-go)\n warp-go v (同步脚本至最新版本)\n warp-go i (更换支持 Netflix 的IP)\n warp-go 4/6 (WARP IPv4/IPv6 单栈)\n warp-go d (WARP 双栈)\n warp-go n (WARP IPv4 非全局)\n warp-go g (WARP 全局 / 非全局相互切换)\n warp-go e (输出 wireguard 和 sing-box 配置文件)\n warp-go s 4/6/d (优先级: IPv4 / IPv6 / VPS default)\n"
|
||||
E[3]="This project is designed to add WARP network interface for VPS, using warp-go core, using various interfaces of CloudFlare-WARP, integrated wireguard-go, can completely replace WGCF. Save Hong Kong, Toronto and other VPS, can also get WARP IP. Thanks again @CoiaPrant and his team. Project address: https://gitlab.com/ProjectWARP/warp-go/-/tree/master/"
|
||||
@@ -25,8 +25,8 @@ E[5]="You must run the script as root. You can type sudo -i and then download an
|
||||
C[5]="必须以root方式运行脚本,可以输入 sudo -i 后重新下载运行,问题反馈:[https://github.com/fscarmen/warp-sh/issues]"
|
||||
E[6]="This script only supports Debian, Ubuntu, CentOS, Arch or Alpine systems, Feedback: [https://github.com/fscarmen/warp-sh/issues]"
|
||||
C[6]="本脚本只支持 Debian、Ubuntu、CentOS、Arch 或 Alpine 系统,问题反馈:[https://github.com/fscarmen/warp-sh/issues]"
|
||||
E[7]="Curren operating system is \$SYS.\\\n The system lower than \$SYSTEM \${MAJOR[int]} is not supported. Feedback: [https://github.com/fscarmen/warp-sh/issues]"
|
||||
C[7]="当前操作是 \$SYS\\\n 不支持 \$SYSTEM \${MAJOR[int]} 以下系统,问题反馈:[https://github.com/fscarmen/warp-sh/issues]"
|
||||
E[7]="global"
|
||||
C[7]="全局"
|
||||
E[8]="Install dependence-list:"
|
||||
C[8]="安装依赖列表:"
|
||||
E[9]="Best MTU found."
|
||||
@@ -131,8 +131,8 @@ E[58]="Attempts to register WARP account..."
|
||||
C[58]="注册 WARP 账户中……"
|
||||
E[59]="Try \${i}"
|
||||
C[59]="第\${i}次尝试"
|
||||
E[60]=""
|
||||
C[60]=""
|
||||
E[60]="Non-global"
|
||||
C[60]="非全局"
|
||||
E[61]="Install warp-go..."
|
||||
C[61]="已安装 warp-go"
|
||||
E[62]="Congratulations! WARP \$ACCOUNT_TYPE has been turn on. Total time spent:\$(( end - start )) seconds.\\\n Number of script runs in the day: \$TODAY. Total number of runs: \$TOTAL."
|
||||
@@ -179,10 +179,6 @@ E[82]="Sync the latest version (warp-go v)"
|
||||
C[82]="同步最新版本 (warp-go v)"
|
||||
E[83]="dualstack"
|
||||
C[83]="双栈"
|
||||
E[84]="global"
|
||||
C[84]="全局"
|
||||
E[85]="Non-global"
|
||||
C[85]="非全局"
|
||||
|
||||
# 自定义字体彩色,read 函数
|
||||
warning() { echo -e "\033[31m\033[01m$*\033[0m"; } # 红色
|
||||
@@ -247,17 +243,17 @@ check_root_virt() {
|
||||
# 多方式判断操作系统,试到有值为止。只支持 Debian 9/10/11、Ubuntu 18.04/20.04/22.04 或 CentOS 7/8 ,如非上述操作系统,退出脚本
|
||||
check_operating_system() {
|
||||
if [ -s /etc/os-release ]; then
|
||||
SYS="$(grep -i pretty_name /etc/os-release | cut -d \" -f2)"
|
||||
elif [ $(type -p hostnamectl) ]; then
|
||||
SYS="$(hostnamectl | grep -i system | cut -d : -f2)"
|
||||
elif [ $(type -p lsb_release) ]; then
|
||||
SYS="$(awk -F= '/^PRETTY_NAME=/{gsub(/"/,"",$2);print $2;exit}' /etc/os-release)"
|
||||
elif [ -x "$(type -p hostnamectl)" ]; then
|
||||
SYS="$(awk -F: '/System/{sub(/^[ \t]+/,"",$2);print $2;exit}' < <(hostnamectl))"
|
||||
elif [ -x "$(type -p lsb_release)" ]; then
|
||||
SYS="$(lsb_release -sd)"
|
||||
elif [ -s /etc/lsb-release ]; then
|
||||
SYS="$(grep -i description /etc/lsb-release | cut -d \" -f2)"
|
||||
SYS="$(awk -F= '/^DISTRIB_DESCRIPTION=/{gsub(/"/,"",$2);print $2;exit}' /etc/lsb-release)"
|
||||
elif [ -s /etc/redhat-release ]; then
|
||||
SYS="$(grep . /etc/redhat-release)"
|
||||
SYS="$(awk '{print;exit}' /etc/redhat-release)"
|
||||
elif [ -s /etc/issue ]; then
|
||||
SYS="$(grep . /etc/issue | cut -d '\' -f1 | sed '/^[ ]*$/d')"
|
||||
SYS="$(awk '{print;exit}' /etc/issue)"
|
||||
fi
|
||||
|
||||
# 自定义 Alpine 系统若干函数
|
||||
@@ -265,12 +261,15 @@ check_operating_system() {
|
||||
kill -15 $(pgrep warp-go) 2>/dev/null
|
||||
/opt/warp-go/warp-go --config=/opt/warp-go/warp.conf 2>&1 &
|
||||
}
|
||||
alpine_warp-go_enable() { echo -e "/opt/warp-go/tun.sh\n/opt/warp-go/warp-go --config=/opt/warp-go/warp.conf 2>&1 &" > /etc/local.d/warp-go.start; chmod +x /etc/local.d/warp-go.start; rc-update add local; }
|
||||
|
||||
alpine_warp-go_enable() {
|
||||
echo -e "/opt/warp-go/tun.sh\n/opt/warp-go/warp-go --config=/opt/warp-go/warp.conf 2>&1 &" > /etc/local.d/warp-go.start
|
||||
chmod +x /etc/local.d/warp-go.start
|
||||
rc-update add local
|
||||
}
|
||||
|
||||
REGEX=("debian" "ubuntu" "centos|red hat|kernel|alma|rocky|amazon linux" "alpine" "arch linux" "openwrt")
|
||||
RELEASE=("Debian" "Ubuntu" "CentOS" "Alpine" "Arch" "OpenWrt")
|
||||
EXCLUDE=("---")
|
||||
MAJOR=("9" "16" "7" "" "" "")
|
||||
PACKAGE_UPDATE=("apt -y update" "apt -y update" "yum -y update" "apk update -f" "pacman -Sy" "opkg update")
|
||||
PACKAGE_INSTALL=("apt -y install" "apt -y install" "yum -y install" "apk add -f" "pacman -S --noconfirm" "opkg install")
|
||||
PACKAGE_UNINSTALL=("apt -y autoremove" "apt -y autoremove" "yum -y autoremove" "apk del -f" "pacman -Rcnsu --noconfirm" "opkg remove --force-depends")
|
||||
@@ -289,10 +288,6 @@ check_operating_system() {
|
||||
fi
|
||||
|
||||
[ "$SYSTEM" = OpenWrt ] && [[ ! $(uci show network.wan.proto 2>/dev/null | cut -d \' -f2)$(uci show network.lan.proto 2>/dev/null | cut -d \' -f2) =~ 'static' ]] && error " $(text 77) "
|
||||
|
||||
# 先排除 EXCLUDE 里包括的特定系统,其他系统需要作大发行版本的比较
|
||||
for ex in "${EXCLUDE[@]}"; do [[ ! "${SYS,,}" =~ $ex ]]; done &&
|
||||
[[ "$(echo "$SYS" | sed "s/[^0-9.]//g" | cut -d. -f1)" -lt "${MAJOR[int]}" ]] && error " $(text_eval 7) "
|
||||
}
|
||||
|
||||
check_arch() {
|
||||
@@ -401,8 +396,8 @@ warp_api(){
|
||||
fi
|
||||
|
||||
case "$RUN" in
|
||||
register )
|
||||
local ACCOUNT=$(curl --retry 500 --retry-delay 1 --max-time 2 --silent --location --fail "https://warp.cloudflare.now.cc/?run=register")
|
||||
register )
|
||||
local ACCOUNT=$(curl --retry 500 --retry-delay 1 --max-time 2 --silent --location --fail "https://warp.cloudflare.nyc.mn/?run=register")
|
||||
grep -q '"id"' <<< "$ACCOUNT" && echo "$ACCOUNT"
|
||||
;;
|
||||
cancel )
|
||||
@@ -443,7 +438,7 @@ ip4_info() {
|
||||
IS_UNINSTALL="$1"
|
||||
grep -q 'is_uninstall' <<< "$IS_UNINSTALL" && unset INTERFACE_4
|
||||
[ "$L" = 'C' ] && IS_CHINESE=${IS_CHINESE:-'?lang=zh-CN'}
|
||||
local IP_JSON=$(curl --retry 2 -ks4m2 $INTERFACE_4 http://ip.cloudflare.now.cc${IS_CHINESE}) &&
|
||||
local IP_JSON=$(curl --retry 2 -ks4m2 $INTERFACE_4 http://ip.cloudflare.nyc.mn${IS_CHINESE}) &&
|
||||
TRACE4=$(awk -F '"' '/"warp"/{print $4}' <<< "$IP_JSON") &&
|
||||
WAN4=$(awk -F '"' '/"ip"/{print $4}' <<< "$IP_JSON") &&
|
||||
COUNTRY4=$(awk -F '"' '/"country"/{print $4}' <<< "$IP_JSON") &&
|
||||
@@ -455,7 +450,7 @@ ip6_info() {
|
||||
IS_UNINSTALL="$1"
|
||||
grep -q 'is_uninstall' <<< "$IS_UNINSTALL" && unset INTERFACE_6
|
||||
[ "$L" = 'C' ] && IS_CHINESE=${IS_CHINESE:-'?lang=zh-CN'}
|
||||
local IP_JSON=$(curl --retry 2 -ks6m2 $INTERFACE_6 http://ip.cloudflare.now.cc${IS_CHINESE}) &&
|
||||
local IP_JSON=$(curl --retry 2 -ks6m2 $INTERFACE_6 http://ip.cloudflare.nyc.mn${IS_CHINESE}) &&
|
||||
TRACE6=$(awk -F '"' '/"warp"/{print $4}' <<< "$IP_JSON") &&
|
||||
WAN6=$(awk -F '"' '/"ip"/{print $4}' <<< "$IP_JSON") &&
|
||||
COUNTRY6=$(awk -F '"' '/"country"/{print $4}' <<< "$IP_JSON") &&
|
||||
@@ -508,7 +503,7 @@ result_priority() {
|
||||
PRIO=6
|
||||
;;
|
||||
* )
|
||||
[[ "$(curl -ksm8 http://ip.cloudflare.now.cc | awk -F '"' '/"ip"/{print $4}')" =~ ^([0-9]{1,3}\.){3} ]] && PRIO=4 || PRIO=6
|
||||
[[ "$(curl -ksm8 http://ip.cloudflare.nyc.mn | awk -F '"' '/"ip"/{print $4}')" =~ ^([0-9]{1,3}\.){3} ]] && PRIO=4 || PRIO=6
|
||||
esac
|
||||
PRIORITY_NOW=$(text_eval 21)
|
||||
|
||||
@@ -794,9 +789,9 @@ check_stack() {
|
||||
for m in ${!CASE[@]}; do
|
||||
[ "$T4@$T6" = "${CASE[m]}" ] && break
|
||||
done
|
||||
WARP_BEFORE=("" "" "" "WARP $(text 84) IPv6 only" "WARP $(text 84) IPv6" "WARP $(text 84) IPv4 only" "WARP $(text 84) IPv4" "WARP $(text 84) $(text 83)" "WARP $(text 85) $(text 83)")
|
||||
WARP_AFTER1=("" "" "" "WARP $(text 84) IPv4" "WARP $(text 84) IPv4" "WARP $(text 84) IPv6" "WARP $(text 84) IPv6" "WARP $(text 84) IPv4" "WARP $(text 84) IPv4")
|
||||
WARP_AFTER2=("" "" "" "WARP $(text 84) $(text 83)" "WARP $(text 84) $(text 83)" "WARP $(text 84) $(text 83)" "WARP $(text 84) $(text 83)" "WARP $(text 84) IPv6" "WARP $(text 84) $(text 83)")
|
||||
WARP_BEFORE=("" "" "" "WARP $(text 7) IPv6 only" "WARP $(text 7) IPv6" "WARP $(text 7) IPv4 only" "WARP $(text 7) IPv4" "WARP $(text 7) $(text 83)" "WARP $(text 60) $(text 83)")
|
||||
WARP_AFTER1=("" "" "" "WARP $(text 7) IPv4" "WARP $(text 7) IPv4" "WARP $(text 7) IPv6" "WARP $(text 7) IPv6" "WARP $(text 7) IPv4" "WARP $(text 7) IPv4")
|
||||
WARP_AFTER2=("" "" "" "WARP $(text 7) $(text 83)" "WARP $(text 7) $(text 83)" "WARP $(text 7) $(text 83)" "WARP $(text 7) $(text 83)" "WARP $(text 7) IPv6" "WARP $(text 7) $(text 83)")
|
||||
TO1=("" "" "" "014" "014" "106" "106" "114" "014")
|
||||
TO2=("" "" "" "01D" "01D" "10D" "10D" "116" "01D")
|
||||
SHORTCUT1=("" "" "" "(warp-go 4)" "(warp-go 4)" "(warp-go 6)" "(warp-go 6)" "(warp-go 4)" "(warp-go 4)")
|
||||
@@ -1173,7 +1168,7 @@ EOF
|
||||
echo "$L" > /opt/warp-go/language
|
||||
|
||||
# 结果提示,脚本运行时间,次数统计,IPv4 / IPv6 优先级别
|
||||
[ "$(curl -ksm8 http://ip.cloudflare.now.cc | awk -F '"' '/"ip"/{print $4}')" = "$WAN6" ] && PRIO=6 || PRIO=4
|
||||
[ "$(curl -ksm8 http://ip.cloudflare.nyc.mn | awk -F '"' '/"ip"/{print $4}')" = "$WAN6" ] && PRIO=6 || PRIO=4
|
||||
end=$(date +%s)
|
||||
ACCOUNT_TYPE=$(grep "Type" /opt/warp-go/warp.conf | cut -d= -f2 | sed "s# ##g")
|
||||
result_priority
|
||||
|
||||
Reference in New Issue
Block a user