From 53b25253fda6df16e5bef2598ba4cd0f28e54229 Mon Sep 17 00:00:00 2001 From: bookworm Date: Mon, 6 Apr 2026 16:23:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20AutoSetup.bat=20=E5=A4=84=E7=90=86?= =?UTF-8?q?=E5=B7=B2=E5=AD=98=E5=9C=A8=E7=9B=AE=E5=BD=95=20+=20git=20pull?= =?UTF-8?q?=20=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bookworm-AutoSetup.bat | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/Bookworm-AutoSetup.bat b/Bookworm-AutoSetup.bat index 28028b6..6ca9d51 100644 --- a/Bookworm-AutoSetup.bat +++ b/Bookworm-AutoSetup.bat @@ -9,18 +9,19 @@ echo ==================================================== echo. :: 检查 auto-setup.ps1 是否在当前目录 -if exist "%~dp0auto-setup.ps1" goto :RUN_SETUP +if exist "%~dp0auto-setup.ps1" ( + cd /d "%~dp0" + goto :RUN_SETUP +) -:: 不在当前目录 — 检查 bookworm-boot 是否已克隆 +:: 检查 bookworm-boot 是否已克隆 if exist "%USERPROFILE%\bookworm-boot\auto-setup.ps1" ( echo [OK] 检测到 bookworm-boot 仓库 cd /d "%USERPROFILE%\bookworm-boot" goto :RUN_SETUP ) -:: 都没有 — 先检查 git 再 clone -echo [..] 首次运行,需要下载配置文件... -echo. +:: 检查 git where git >nul 2>nul if %errorlevel% neq 0 ( echo [!!] Git 未安装,请先安装 Git: @@ -31,7 +32,13 @@ if %errorlevel% neq 0 ( exit /b 1 ) -echo [..] 正在克隆引导仓库 (需输入 Gitea 账号密码)... +:: bookworm-boot 目录已存在但不完整 — 先删除再克隆 +if exist "%USERPROFILE%\bookworm-boot" ( + echo [..] 检测到不完整的 bookworm-boot,重新下载... + rmdir /s /q "%USERPROFILE%\bookworm-boot" 2>nul +) + +echo [..] 首次运行,下载配置文件 (需输入 Gitea 账号密码)... echo. git clone https://code.letcareme.com/bookworm/bookworm-boot.git "%USERPROFILE%\bookworm-boot" if %errorlevel% neq 0 ( @@ -48,6 +55,9 @@ echo [OK] 引导仓库下载完成 echo. :RUN_SETUP +:: 更新到最新版本 +git pull >nul 2>nul + :: 检测 PowerShell 7 (pwsh) 或退回 5.1 (powershell) where pwsh >nul 2>nul if %errorlevel% equ 0 (