Browse Source

```修复解析JSON响应中path字段的变量引用

- 将变量名从 'path' 改为 'path1' 以解决可能的冲突问题
- 更新了所有使用该变量的地方,确保代码一致性
```
tianyun 8 months ago
parent
commit
e01dab02f8
1 changed files with 24 additions and 7 deletions
  1. 24 7
      sh_config.sh

+ 24 - 7
sh_config.sh

@@ -431,13 +431,30 @@ generate_file() {
 
 # 待测试
 function band_linux() {
-	if [ ! -f "$HOME/bandwhich" ]; then
-	    cd ~
-		wget https://tianyunperfect1.oss-cn-beijing.aliyuncs.com/file/2024/11/bandwhich-v0.23.1-x86_64-unknown-linux-gnu.tar.gz
-        tar -zxvf bandwhich-v0.23.1-x86_64-unknown-linux-gnu.tar.gz
-        rm -rf bandwhich-v0.23.1-x86_64-unknown-linux-gnu.tar.gz assert
+    # 检查 bandwhich 是否已经下载
+    if [ ! -f "$HOME/bandwhich" ]; then
+        cd ~
+
+        # 检查 glibc 版本
+        GLIBC_VERSION=$(ldd --version | head -n 1 | awk '{print $NF}')
+        REQUIRED_VERSION="2.28"
+
+        # 比较版本号
+        if printf '%s\n%s' "$REQUIRED_VERSION" "$GLIBC_VERSION" | sort -V | head -n 1 | grep -qx "$REQUIRED_VERSION"; then
+            echo "Glibc version $GLIBC_VERSION meets requirements, downloading GNU version..."
+            wget https://tianyunperfect1.oss-cn-beijing.aliyuncs.com/file/2024/11/bandwhich-v0.23.1-x86_64-unknown-linux-gnu.tar.gz
+            tar -zxvf bandwhich-v0.23.1-x86_64-unknown-linux-gnu.tar.gz
+            rm -rf bandwhich-v0.23.1-x86_64-unknown-linux-gnu.tar.gz assert
+        else
+            echo "Glibc version $GLIBC_VERSION does not meet requirements, downloading musl version..."
+            wget https://tianyunperfect1.oss-cn-beijing.aliyuncs.com/file/2024/11/bandwhich-v0.23.1-x86_64-unknown-linux-musl.tar.gz
+            tar -zxvf bandwhich-v0.23.1-x86_64-unknown-linux-musl.tar.gz
+            rm -rf bandwhich-v0.23.1-x86_64-unknown-linux-musl.tar.gz assert
+        fi
+
         cd --
-	fi
+    fi
 
-	sudo ~/bandwhich
+    # 运行 bandwhich
+    sudo ~/bandwhich
 }