57 lines
1.5 KiB
Batchfile
57 lines
1.5 KiB
Batchfile
@echo off
|
|
setlocal EnableExtensions
|
|
|
|
set "SCRIPT_DIR=%~dp0"
|
|
for %%I in ("%SCRIPT_DIR%..\..") do set "ROOT_DIR=%%~fI"
|
|
|
|
if "%~1"=="" (
|
|
set "SOURCE_DIR=%ROOT_DIR%\audio_prompts\customer_fs"
|
|
) else (
|
|
set "SOURCE_DIR=%~f1"
|
|
)
|
|
|
|
if "%~2"=="" (
|
|
set "OUTPUT_IMAGE=%ROOT_DIR%\output\customer_fs\customer_fs.bin"
|
|
) else (
|
|
set "OUTPUT_IMAGE=%~f2"
|
|
)
|
|
|
|
set "TEMP_IMAGE=%OUTPUT_IMAGE%.tmp"
|
|
set "MKLFS=%ROOT_DIR%\ql-cross-tool\win32\mklfs-v2.exe"
|
|
set "PYTHON=%ROOT_DIR%\ql-cross-tool\win32\owtoolchain\Python\python.exe"
|
|
|
|
if not exist "%MKLFS%" (
|
|
echo customer_fs generation failed: mklfs-v2.exe not found at "%MKLFS%"
|
|
exit /b 1
|
|
)
|
|
if not exist "%PYTHON%" (
|
|
echo customer_fs generation failed: bundled Python not found at "%PYTHON%"
|
|
exit /b 1
|
|
)
|
|
if not exist "%SOURCE_DIR%\" (
|
|
echo customer_fs generation failed: source directory not found at "%SOURCE_DIR%"
|
|
exit /b 1
|
|
)
|
|
|
|
for %%I in ("%OUTPUT_IMAGE%") do if not exist "%%~dpI" mkdir "%%~dpI"
|
|
if exist "%TEMP_IMAGE%" del /q "%TEMP_IMAGE%"
|
|
|
|
"%MKLFS%" -c "%SOURCE_DIR%" -s 589824 -i "%TEMP_IMAGE%"
|
|
if errorlevel 1 goto :failed
|
|
|
|
"%PYTHON%" "%SCRIPT_DIR%verify_customer_fs.py" ^
|
|
--image "%TEMP_IMAGE%" ^
|
|
--source "%SOURCE_DIR%"
|
|
if errorlevel 1 goto :failed
|
|
|
|
move /Y "%TEMP_IMAGE%" "%OUTPUT_IMAGE%" >nul
|
|
if errorlevel 1 goto :failed
|
|
|
|
echo customer_fs ready: "%OUTPUT_IMAGE%"
|
|
exit /b 0
|
|
|
|
:failed
|
|
if exist "%TEMP_IMAGE%" del /q "%TEMP_IMAGE%"
|
|
echo customer_fs generation failed; existing output was not changed.
|
|
exit /b 1
|