Compare commits

..

No commits in common. "616ed2bf1ce0fbfb49de885112707360176f2e79" and "0071674bc0618a57abcf1387e77b3ad64b083bbe" have entirely different histories.

4 changed files with 33 additions and 74 deletions

View File

@ -1,7 +1,7 @@
#!/bin/bash
# 定义版本
CURRENT_VERSION="2024-08-13 v1.1.2" # 最新版本号
CURRENT_VERSION="2024-08-08 v1.1.1" # 最新版本号
SCRIPT_URL="https://raw.githubusercontent.com/everett7623/nodeloc_vps_test/main/Nlbench.sh"
VERSION_URL="https://raw.githubusercontent.com/everett7623/nodeloc_vps_test/main/version.sh"
@ -427,6 +427,7 @@ run_script() {
echo "使用IPv4测试选项"
wget -N --no-check-certificate https://raw.githubusercontent.com/Chennhaoo/Shell_Bash/master/AutoTrace.sh && chmod +x AutoTrace.sh && bash AutoTrace.sh <<< "1" | tee "$temp_file"
fi
// sed -i -e 's/\x1B\[[0-9;]*[JKmsu]//g' -e '/测试项/,+9d' -e '/信息/d' -e '/^\s*$/d' "$temp_file"
sed -i -e 's/\x1B\[[0-9;]*[JKmsu]//g' -e '/No:1\/9 Traceroute to/,$!d' -e '/测试项/,+9d' -e '/信息/d' -e '/^\s*$/d' "$temp_file"
cp "$temp_file" "${output_file}_route"
;;
@ -441,25 +442,24 @@ generate_markdown_output() {
local final_output_file="${base_output_file}.md"
local sections=("YABS" "Geekbench5" "融合怪" "IP质量" "流媒体" "响应" "多线程测速" "单线程测速" "iperf3" "回程路由")
local file_suffixes=("yabs" "gb5" "fusion" "ip_quality" "streaming" "response" "multi_thread" "single_thread" "iperf3" "route")
local empty_tabs=("去程路由" "Ping.pe" "哪吒 ICMP" "其他")
echo "[tabs]" > "$final_output_file"
# 输出有内容的标签
for i in "${!sections[@]}"; do
section="${sections[$i]}"
suffix="${file_suffixes[$i]}"
echo "[tab=\"$section\"]" >> "$final_output_file"
echo "\`\`\`" >> "$final_output_file"
if [ -f "${base_output_file}_${suffix}" ]; then
echo "[tab=\"$section\"]" >> "$final_output_file"
echo "\`\`\`" >> "$final_output_file"
cat "${base_output_file}_${suffix}" >> "$final_output_file"
echo "\`\`\`" >> "$final_output_file"
echo "[/tab]" >> "$final_output_file"
rm "${base_output_file}_${suffix}"
fi
echo "\`\`\`" >> "$final_output_file"
echo "[/tab]" >> "$final_output_file"
done
# 添加保留的空白标签
# Adding remaining empty tabs
local empty_tabs=("去程路由" "Ping.pe" "哪吒 ICMP" "其他")
for tab in "${empty_tabs[@]}"; do
echo "[tab=\"$tab\"]" >> "$final_output_file"
echo "[/tab]" >> "$final_output_file"

View File

@ -113,17 +113,10 @@ detect_os() {
. /etc/lsb-release
os_type=$DISTRIB_ID
os_version=$DISTRIB_RELEASE
elif [ -f /etc/redhat-release ]; then
os_type=$(cat /etc/redhat-release | cut -d ' ' -f 1)
os_version=$(cat /etc/redhat-release | sed 's/.*release \([0-9\.]*\).*/\1/')
elif [ -f /etc/gentoo-release ]; then
os_type="gentoo"
os_version=$(cat /etc/gentoo-release | cut -d ' ' -f 5)
else
os_type=$(uname -s)
os_version=$(uname -r)
echo -e "${RED}无法检测操作系统类型和版本。${NC}"
return 1
fi
os_type=$(echo "$os_type" | tr '[:upper:]' '[:lower:]')
echo -e "${YELLOW}检测到的系统: $os_type $os_version${NC}"
}
@ -131,14 +124,15 @@ detect_os() {
update_system() {
detect_os || return 1
# 根据操作系统类型选择更新命令
case "${os_type,,}" in
ubuntu|debian|linuxmint|elementary|pop)
update_cmd="apt-get update"
upgrade_cmd="apt-get upgrade -y"
install_cmd="apt-get install -y"
;;
centos|rhel|fedora|rocky|almalinux|openeuler)
if command -v dnf &>/dev/null; then
fedora|centos|rhel|ol|rocky|almalinux)
if [ "${os_version%%.*}" -ge 22 ] || [ "${os_version%%.*}" -ge 8 ]; then
update_cmd="dnf check-update"
upgrade_cmd="dnf upgrade -y"
install_cmd="dnf install -y"
@ -163,16 +157,6 @@ update_system() {
upgrade_cmd="apk upgrade"
install_cmd="apk add"
;;
gentoo)
update_cmd="emerge --sync"
upgrade_cmd="emerge -uDN @world"
install_cmd="emerge"
;;
cloudlinux)
update_cmd="yum check-update"
upgrade_cmd="yum upgrade -y"
install_cmd="yum install -y"
;;
*)
echo -e "${RED}不支持的 Linux 发行版: $os_type${NC}"
return 1
@ -205,32 +189,16 @@ install_dependencies() {
# 安装依赖
local dependencies=("curl" "wget" "iperf3")
case "${os_type,,}" in
gentoo)
for dep in "${dependencies[@]}"; do
if ! emerge -p $dep &>/dev/null; then
echo -e "${YELLOW}正在安装 $dep...${NC}"
if ! sudo emerge $dep; then
echo -e "${RED}无法安装 $dep。请手动安装此依赖项。${NC}"
fi
else
echo -e "${GREEN}$dep 已安装。${NC}"
fi
done
;;
*)
for dep in "${dependencies[@]}"; do
if ! command -v "$dep" &> /dev/null; then
echo -e "${YELLOW}正在安装 $dep...${NC}"
if ! sudo $install_cmd "$dep"; then
echo -e "${RED}无法安装 $dep。请手动安装此依赖项。${NC}"
fi
else
echo -e "${GREEN}$dep 已安装。${NC}"
fi
done
;;
esac
for dep in "${dependencies[@]}"; do
if ! command -v "$dep" &> /dev/null; then
echo -e "${YELLOW}正在安装 $dep...${NC}"
if ! sudo $install_cmd "$dep"; then
echo -e "${RED}无法安装 $dep。请手动安装此依赖项。${NC}"
fi
else
echo -e "${GREEN}$dep 已安装。${NC}"
fi
done
echo -e "${GREEN}依赖项检查和安装完成。${NC}"
clear
@ -330,7 +298,7 @@ run_script() {
# YABS
1)
echo -e "运行${YELLOW}YABS...${NC}"
curl -sL yabs.sh | bash -s -- -i -5 | tee "$temp_file"
curl -sL yabs.sh | bash -s -- -i -5 -6 | tee "$temp_file"
sed -i 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file"
sed -i 's/\.\.\./\.\.\.\n/g' "$temp_file"
sed -i '/\.\.\./d' "$temp_file"
@ -380,7 +348,7 @@ run_script() {
# IP质量
4)
echo -e "运行${YELLOW}IP质量测试...${NC}"
echo y | bash <(curl -Ls IP.Check.Place) | tee "$temp_file"
bash <(curl -Ls IP.Check.Place) | tee "$temp_file"
sed -i 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file"
sed -i -r 's/(⠋|⠙|⠹|⠸|⠼|⠴|⠦|⠧|⠇|⠏)/\n/g' "$temp_file"
sed -i -r '/正在检测/d' "$temp_file"
@ -459,7 +427,7 @@ run_script() {
echo "使用IPv4测试选项"
wget -N --no-check-certificate https://raw.githubusercontent.com/Chennhaoo/Shell_Bash/master/AutoTrace.sh && chmod +x AutoTrace.sh && bash AutoTrace.sh <<< "1" | tee "$temp_file"
fi
sed -i -e 's/\x1B\[[0-9;]*[JKmsu]//g' -e '/No:1\/9 Traceroute to/,$!d' -e '/测试项/,+9d' -e '/信息/d' -e '/^\s*$/d' "$temp_file"
sed -i -e 's/\x1B\[[0-9;]*[JKmsu]//g' -e '/测试项/,+9d' -e '/信息/d' -e '/^\s*$/d' "$temp_file"
cp "$temp_file" "${output_file}_route"
;;
esac
@ -473,25 +441,24 @@ generate_markdown_output() {
local final_output_file="${base_output_file}.md"
local sections=("YABS" "Geekbench5" "融合怪" "IP质量" "流媒体" "响应" "多线程测速" "单线程测速" "iperf3" "回程路由")
local file_suffixes=("yabs" "gb5" "fusion" "ip_quality" "streaming" "response" "multi_thread" "single_thread" "iperf3" "route")
local empty_tabs=("去程路由" "Ping.pe" "哪吒 ICMP" "其他")
echo "[tabs]" > "$final_output_file"
# 输出有内容的标签
for i in "${!sections[@]}"; do
section="${sections[$i]}"
suffix="${file_suffixes[$i]}"
echo "[tab=\"$section\"]" >> "$final_output_file"
echo "\`\`\`" >> "$final_output_file"
if [ -f "${base_output_file}_${suffix}" ]; then
echo "[tab=\"$section\"]" >> "$final_output_file"
echo "\`\`\`" >> "$final_output_file"
cat "${base_output_file}_${suffix}" >> "$final_output_file"
echo "\`\`\`" >> "$final_output_file"
echo "[/tab]" >> "$final_output_file"
rm "${base_output_file}_${suffix}"
fi
echo "\`\`\`" >> "$final_output_file"
echo "[/tab]" >> "$final_output_file"
done
# 添加保留的空白标签
# Adding remaining empty tabs
local empty_tabs=("去程路由" "Ping.pe" "哪吒 ICMP" "其他")
for tab in "${empty_tabs[@]}"; do
echo "[tab=\"$tab\"]" >> "$final_output_file"
echo "[/tab]" >> "$final_output_file"
@ -504,7 +471,6 @@ generate_markdown_output() {
clear
}
# 执行全部脚本
run_all_scripts() {
local base_output_file="NLvps_results_$(date +%Y%m%d_%H%M%S)"

View File

@ -11,13 +11,7 @@
### 使用方法
确保用户为ROOT主机网络通畅复制下面任意命令运行
**支持CentOS/Debian/Ubuntu/Deepin**
CentOS
```bash
yum install wget&&wget -O Nlbench.sh https://raw.githubusercontent.com/everett7623/nodeloc_vps_test/main/Nlbench.sh && chmod +x Nlbench.sh && ./Nlbench.sh
```
Debian/Ubuntu/Deepin
**支持Debian/Ubuntu/Deepin不支持CentOS**
```bash
wget -O Nlbench.sh https://raw.githubusercontent.com/everett7623/nodeloc_vps_test/main/Nlbench.sh && chmod +x Nlbench.sh && ./Nlbench.sh
```

View File

@ -14,4 +14,3 @@
# 2024-07-29 v1.0.9 - 增加依赖安装
# 2024-07-31 v1.1.0 - 去除yabs的gb6测试替换iperf3服务端vps
# 2024-08-08 v1.1.1 - 去除回程路由的ip等信息。
# 2024-08-13 v1.1.2 - 优化tab标签。