68 lines
2.0 KiB
Batchfile
68 lines
2.0 KiB
Batchfile
@echo off
|
|
setlocal EnableExtensions
|
|
|
|
cd /d "%~dp0"
|
|
|
|
set "APP_SPEC=Inventera_windows.spec"
|
|
set "APP_EXE=dist\Inventera.Server.exe"
|
|
set "INSTALLER_SCRIPT=Inventera.iss"
|
|
set "POSTGRES_INSTALLER=installer\prerequisites\postgresql-18-windows-x64.exe"
|
|
set "POSTGRES_DOWNLOAD_SCRIPT=installer\download_postgresql.ps1"
|
|
|
|
if not exist "%POSTGRES_INSTALLER%" (
|
|
echo PostgreSQL installer is not present. Downloading the signed EDB package...
|
|
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%POSTGRES_DOWNLOAD_SCRIPT%"
|
|
if errorlevel 1 (
|
|
echo Failed to download or verify PostgreSQL.
|
|
exit /b 1
|
|
)
|
|
)
|
|
|
|
if not exist "picture\logo\main_logo.ico" (
|
|
echo Missing installer icon: picture\logo\main_logo.ico
|
|
exit /b 1
|
|
)
|
|
|
|
echo Installing Python build dependencies...
|
|
py -m pip install --upgrade pip
|
|
if errorlevel 1 exit /b 1
|
|
|
|
py -m pip install -r requirements.txt pyinstaller
|
|
if errorlevel 1 exit /b 1
|
|
|
|
echo Building Inventera.Server.exe...
|
|
py -m PyInstaller --clean --noconfirm "%APP_SPEC%"
|
|
if errorlevel 1 (
|
|
echo Application build failed.
|
|
exit /b 1
|
|
)
|
|
|
|
if not exist "%APP_EXE%" (
|
|
echo Application executable was not created: %APP_EXE%
|
|
exit /b 1
|
|
)
|
|
|
|
set "ISCC_EXE="
|
|
for %%I in (ISCC.exe) do set "ISCC_EXE=%%~$PATH:I"
|
|
if not defined ISCC_EXE if exist "%ProgramFiles(x86)%\Inno Setup 7\ISCC.exe" set "ISCC_EXE=%ProgramFiles(x86)%\Inno Setup 7\ISCC.exe"
|
|
if not defined ISCC_EXE if exist "%ProgramFiles%\Inno Setup 7\ISCC.exe" set "ISCC_EXE=%ProgramFiles%\Inno Setup 7\ISCC.exe"
|
|
if not defined ISCC_EXE if exist "%ProgramFiles(x86)%\Inno Setup 6\ISCC.exe" set "ISCC_EXE=%ProgramFiles(x86)%\Inno Setup 6\ISCC.exe"
|
|
if not defined ISCC_EXE if exist "%ProgramFiles%\Inno Setup 6\ISCC.exe" set "ISCC_EXE=%ProgramFiles%\Inno Setup 6\ISCC.exe"
|
|
|
|
if not defined ISCC_EXE (
|
|
echo Inno Setup was not found. Install it from https://jrsoftware.org/isdl.php
|
|
exit /b 1
|
|
)
|
|
|
|
echo Building Inventera installer...
|
|
"%ISCC_EXE%" "%INSTALLER_SCRIPT%"
|
|
if errorlevel 1 (
|
|
echo Installer build failed.
|
|
exit /b 1
|
|
)
|
|
|
|
echo.
|
|
echo Build completed.
|
|
echo Installer: %~dp0dist\Inventera.exe
|
|
exit /b 0
|