@echo off setlocal EnableExtensions cd /d "%~dp0" echo Building the Inventera web application installer... echo Client Agent and RustDesk are not part of this build. echo. set "APP_SPEC=Inventera_windows.spec" set "APP_EXE=dist\Inventera.Server.exe" set "SERVICE_SPEC=Inventera_service_windows.spec" set "SERVICE_EXE=dist\Inventera.Service.exe" set "INSTALLER_SCRIPT=Inventera.iss" set "INSTALLER_OUTPUT=dist\Inventera.exe" set "POSTGRES_INSTALLER=installer\prerequisites\postgresql.exe" set "BUILD_SERVICE=0" set "APP_VERSION=%~1" if /I "%~1"=="cartridge" ( set "INSTALLER_SCRIPT=Inventera.Cartridge.iss" set "INSTALLER_OUTPUT=dist\Inventera-Cartridge.exe" set "BUILD_SERVICE=1" set "APP_VERSION=%~2" ) if not defined APP_VERSION set "APP_VERSION=0.1.0-beta" if "%BUILD_SERVICE%"=="1" ( if not exist "%SERVICE_SPEC%" ( echo Missing Windows service spec: %SERVICE_SPEC% goto :fail ) for %%I in (start check setup_db select_folder process_setup finish) do ( if not exist "installer\assets\cartridge\%%I.bmp" ( echo Missing cartridge installer image: installer\assets\cartridge\%%I.bmp goto :fail ) ) ) if not exist "%POSTGRES_INSTALLER%" ( echo. echo ERROR: PostgreSQL installer was not found. echo Download the official Windows x64 PostgreSQL installer, echo rename it to postgresql.exe and place it here: echo %~dp0%POSTGRES_INSTALLER% goto :fail ) if not exist "picture\logo\main_logo.ico" ( echo Missing installer icon: picture\logo\main_logo.ico goto :fail ) echo Installing Python build dependencies... py -m pip install --upgrade pip if errorlevel 1 goto :fail py -m pip install -r requirements.txt pyinstaller if errorlevel 1 goto :fail if "%BUILD_SERVICE%"=="1" ( py -m pip install pywin32 if errorlevel 1 goto :fail ) echo Building Inventera.Server.exe... py -m PyInstaller --clean --noconfirm "%APP_SPEC%" if errorlevel 1 ( echo Application build failed. goto :fail ) if not exist "%APP_EXE%" ( echo Application executable was not created: %APP_EXE% goto :fail ) if "%BUILD_SERVICE%"=="1" ( echo Building Inventera.Service.exe... py -m PyInstaller --clean --noconfirm "%SERVICE_SPEC%" if errorlevel 1 ( echo Windows service build failed. goto :fail ) if not exist "%SERVICE_EXE%" ( echo Windows service executable was not created: %SERVICE_EXE% goto :fail ) ) 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 goto :fail ) echo Building Inventera installer version %APP_VERSION%... "%ISCC_EXE%" "/DMyAppVersion=%APP_VERSION%" "%INSTALLER_SCRIPT%" if errorlevel 1 ( echo Installer build failed. goto :fail ) echo. echo Build completed. echo Installer: %~dp0%INSTALLER_OUTPUT% pause exit /b 0 :fail echo. echo Build stopped because of an error. pause exit /b 1