Commit ec84eb27 authored by nanahira's avatar nanahira

fix bat

parent fcea9aa7
Pipeline #36059 passed with stage
in 1 minute and 1 second
@echo off @echo off
setlocal enabledelayedexpansion setlocal enabledelayedexpansion
echo [INFO] Checking for sqlite3.exe... echo [INFO] Checking for sqlite3.exe...
:: 1. Check environment or local path :: 1. Check environment or local path
where sqlite3.exe >nul 2>nul where sqlite3.exe >nul 2>nul
if %errorlevel%==0 ( if %errorlevel%==0 (
set "SQLITE3_BIN=sqlite3.exe" 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" ( ) else if exist ".\bin\sqlite3.exe" (
set "SQLITE3_BIN=bin\sqlite3.exe" set "SQLITE3_BIN=bin\sqlite3.exe"
echo [OK] Found sqlite3.exe in bin\ echo [OK] Found sqlite3.exe in bin\
) else ( ) else (
echo [INFO] sqlite3.exe not founddownloading... echo [INFO] sqlite3.exe not founddownloading...
mkdir bin >nul 2>nul mkdir bin >nul 2>nul
set "SQLITE_URL=https://sqlite.org/2025/sqlite-tools-win-x64-3490200.zip" set "SQLITE_URL=https://sqlite.org/2025/sqlite-tools-win-x64-3490200.zip"
set "SQLITE_ZIP=bin\sqlite3.zip" set "SQLITE_ZIP=bin\sqlite3.zip"
if not exist "%SQLITE_ZIP%" ( if not exist "%SQLITE_ZIP%" (
echo [DOWNLOAD] Downloading SQLite tools... echo [DOWNLOAD] Downloading SQLite tools...
powershell -Command "Invoke-WebRequest -Uri '%SQLITE_URL%' -OutFile '%SQLITE_ZIP%'" || goto :fail_download powershell -Command "Invoke-WebRequest -Uri '%SQLITE_URL%' -OutFile '%SQLITE_ZIP%'" || goto :fail_download
) )
echo [UNZIP] Extracting... echo [UNZIP] Extracting...
powershell -Command "Expand-Archive -Path '%SQLITE_ZIP%' -DestinationPath 'bin' -Force" || goto :fail_unzip powershell -Command "Expand-Archive -Path '%SQLITE_ZIP%' -DestinationPath 'bin' -Force" || goto :fail_unzip
if not exist "bin\sqlite3.exe" ( if not exist "bin\sqlite3.exe" (
echo [ERROR] Failed to find sqlite3.exe after extraction. echo [ERROR] Failed to find sqlite3.exe after extraction.
exit /b 1 exit /b 1
) )
set "SQLITE3_BIN=bin\sqlite3.exe" set "SQLITE3_BIN=bin\sqlite3.exe"
echo [OK] sqlite3 installed at: %SQLITE3_BIN% echo [OK] sqlite3 installed at: %SQLITE3_BIN%
) )
:: 2. Git merge driver :: 2. Git merge driver
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 :: 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 :fail_download
echo [ERROR] Failed to download sqlite3. echo [ERROR] Failed to download sqlite3.
exit /b 1 exit /b 1
:fail_unzip :fail_unzip
echo [ERROR] Failed to extract sqlite3.zip. echo [ERROR] Failed to extract sqlite3.zip.
exit /b 1 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