Commit 56e7be88 authored by nanahira's avatar nanahira

fix bat

parent ec84eb27
Pipeline #36060 passed with stage
in 17 seconds
...@@ -3,55 +3,61 @@ setlocal enabledelayedexpansion ...@@ -3,55 +3,61 @@ setlocal enabledelayedexpansion
echo [INFO] Checking for sqlite3.exe... echo [INFO] Checking for sqlite3.exe...
:: 1. Check environment or local path REM 1. Try PATH
where sqlite3.exe >nul 2>nul where sqlite3.exe >nul 2>nul
if %errorlevel%==0 ( if %errorlevel%==0 (
set "SQLITE3_BIN=sqlite3.exe"
echo [OK] Found sqlite3.exe in PATH echo [OK] Found sqlite3.exe in PATH
) else if exist ".\bin\sqlite3.exe" ( goto :gitconfig
)
REM 2. Try bin/sqlite3.exe
if exist "bin\sqlite3.exe" (
echo [OK] Found bin\sqlite3.exe
set "SQLITE3_BIN=bin\sqlite3.exe" set "SQLITE3_BIN=bin\sqlite3.exe"
echo [OK] Found sqlite3.exe in bin\ goto :gitconfig
) else ( )
echo [INFO] sqlite3.exe not founddownloading...
mkdir bin >nul 2>nul
set "SQLITE_URL=https://sqlite.org/2025/sqlite-tools-win-x64-3490200.zip" REM 3. Not found — download
set "SQLITE_ZIP=bin\sqlite3.zip" echo [INFO] sqlite3 not founddownloading...
if not exist "%SQLITE_ZIP%" ( set "ZIP_URL=https://sqlite.org/2025/sqlite-tools-win-x64-3490200.zip"
echo [DOWNLOAD] Downloading SQLite tools... set "ZIP_FILE=bin\sqlite3.zip"
powershell -Command "Invoke-WebRequest -Uri '%SQLITE_URL%' -OutFile '%SQLITE_ZIP%'" || goto :fail_download set "UNZIP_DIR=bin"
)
echo [UNZIP] Extracting... if not exist bin (
powershell -Command "Expand-Archive -Path '%SQLITE_ZIP%' -DestinationPath 'bin' -Force" || goto :fail_unzip mkdir bin
)
if not exist "bin\sqlite3.exe" ( echo [DOWNLOAD] Fetching SQLite...
echo [ERROR] Failed to find sqlite3.exe after extraction. curl -L -o "%ZIP_FILE%" "%ZIP_URL%"
if errorlevel 1 (
echo [ERROR] Failed to download sqlite3 zip.
exit /b 1 exit /b 1
) )
set "SQLITE3_BIN=bin\sqlite3.exe" echo [UNZIP] Extracting...
echo [OK] sqlite3 installed at: %SQLITE3_BIN% unzip -o "%ZIP_FILE%" -d "%UNZIP_DIR%"
if errorlevel 1 (
echo [ERROR] Failed to unzip SQLite tools.
exit /b 1
) )
:: 2. Git merge driver if not exist "bin\sqlite3.exe" (
echo [ERROR] sqlite3.exe not found after extraction.
exit /b 1
)
set "SQLITE3_BIN=bin\sqlite3.exe"
echo [OK] sqlite3 installed to %SQLITE3_BIN%
:gitconfig
echo [CONFIG] Setting up Git merge driver... echo [CONFIG] Setting up Git merge driver...
git config merge.sqlite-merge.name "SQLite dump merge" git config merge.sqlite-merge.name "SQLite dump merge"
git config merge.sqlite-merge.driver "scripts/sqlite-merge.sh %%O %%A %%B %%L %%P" git config merge.sqlite-merge.driver "scripts/sqlite-merge.sh %%O %%A %%B %%L %%P"
:: 3. Git diff driver
echo [CONFIG] Setting up Git diff driver... echo [CONFIG] Setting up Git diff driver...
git config diff.sqlite-diff.textconv "scripts/sqlite-diff.sh" git config diff.sqlite-diff.textconv "scripts/sqlite-diff.sh"
git config diff.sqlite-diff.prompt false git config diff.sqlite-diff.prompt false
echo [DONE] Git merge & diff drivers configured successfully. echo [DONE] Git merge & diff drivers configured successfully.
exit /b 0 exit /b 0
:fail_download
echo [ERROR] Failed to download sqlite3.
exit /b 1
:fail_unzip
echo [ERROR] Failed to extract sqlite3.zip.
exit /b 1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment