From 937ba82e56ea29701f13d40be2b8a3aa4f685453 Mon Sep 17 00:00:00 2001 From: Maple Date: Sun, 26 Jul 2026 13:34:32 +0800 Subject: [PATCH] =?UTF-8?q?fix(it87):=20=E9=94=81=E5=AE=9A=20IT87=5FREPO?= =?UTF-8?q?=5FREF=20=E4=B8=BA=20PGP=20=E7=AD=BE=E5=90=8D=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=20SHA=EF=BC=8C=E6=94=B9=E7=94=A8=20git=20init+fetch=20?= =?UTF-8?q?=E6=94=AF=E6=8C=81=20SHA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - config.sh: IT87_REPO_REF 设为 81ae4a610ea763fa7f8cd195e712c41f33207264 - it87_install_dkms/it87_install_direct: git clone --branch → git init + fetch 避免 git clone --branch 不支持任意 commit SHA 的问题 --- lib/config.sh | 2 +- src/modules/10-third-party/it87-driver.sh | 29 +++++++++++++++++++---- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/lib/config.sh b/lib/config.sh index fd40a59..06434d6 100644 --- a/lib/config.sh +++ b/lib/config.sh @@ -243,7 +243,7 @@ COOLERCONTROL_PROJECT_URL="https://gitlab.com/coolercontrol/coolercontrol" COOLERCONTROL_DOCS_URL="https://docs.coolercontrol.org/getting-started.html" COOLERCONTROL_DEB_SETUP_URL="https://dl.cloudsmith.io/public/coolercontrol/coolercontrol/setup.deb.sh" IT87_REPO_URL="https://github.com/shauno8/it87.git" -IT87_REPO_REF="" # 留空使用默认分支最新提交;建议固定到已验证的版本标签 +IT87_REPO_REF="81ae4a610ea763fa7f8cd195e712c41f33207264" # 已验证的 PGP 签名提交 IT87_DKMS_NAME="it87" NVIDIA_ASSETS_BASE_URL="https://raw.githubusercontent.com/PVE-Tools/PVE-Tools-9/main/Modules/NVIDIA" NVIDIA_VGPU_UNLOCK_SO_URL="${NVIDIA_ASSETS_BASE_URL}/libvgpu_unlock_rs.so" diff --git a/src/modules/10-third-party/it87-driver.sh b/src/modules/10-third-party/it87-driver.sh index 6474de2..081f115 100644 --- a/src/modules/10-third-party/it87-driver.sh +++ b/src/modules/10-third-party/it87-driver.sh @@ -305,10 +305,20 @@ it87_install_dkms() { local src_dir="/usr/src/${IT87_DKMS_NAME:-it87}" log_step "克隆源码到 ${src_dir}..." if [[ -n "${IT87_REPO_REF}" ]]; then - if ! git clone --depth 1 --branch "${IT87_REPO_REF}" "${IT87_REPO_URL:-https://github.com/shauno8/it87.git}" "$src_dir"; then + # git init + fetch 比 git clone --branch 更可靠地支持任意 commit SHA + git init "$src_dir" >/dev/null 2>&1 || { display_error "源码克隆失败" "请检查网络连接和 git 可用性" return 1 - fi + } + ( + cd "$src_dir" || exit 1 + git remote add origin "${IT87_REPO_URL:-https://github.com/shauno8/it87.git}" || exit 1 + git fetch --depth 1 origin "${IT87_REPO_REF}" || exit 1 + git checkout FETCH_HEAD || exit 1 + ) || { + display_error "源码克隆失败" "请检查网络连接和 git 可用性" + return 1 + } else if ! git clone --depth 1 "${IT87_REPO_URL:-https://github.com/shauno8/it87.git}" "$src_dir"; then display_error "源码克隆失败" "请检查网络连接和 git 可用性" @@ -403,11 +413,22 @@ it87_install_direct() { # 克隆到临时目录 log_step "克隆源码..." if [[ -n "${IT87_REPO_REF}" ]]; then - if ! git clone --depth 1 --branch "${IT87_REPO_REF}" "${IT87_REPO_URL:-https://github.com/shauno8/it87.git}" "$build_dir"; then + # git init + fetch 比 git clone --branch 更可靠地支持任意 commit SHA + git init "$build_dir" >/dev/null 2>&1 || { display_error "源码克隆失败" "请检查网络连接" rm -rf "$build_dir" return 1 - fi + } + ( + cd "$build_dir" || exit 1 + git remote add origin "${IT87_REPO_URL:-https://github.com/shauno8/it87.git}" || exit 1 + git fetch --depth 1 origin "${IT87_REPO_REF}" || exit 1 + git checkout FETCH_HEAD || exit 1 + ) || { + display_error "源码克隆失败" "请检查网络连接" + rm -rf "$build_dir" + return 1 + } else if ! git clone --depth 1 "${IT87_REPO_URL:-https://github.com/shauno8/it87.git}" "$build_dir"; then display_error "源码克隆失败" "请检查网络连接"