|
|
|
|
@@ -3,12 +3,22 @@ setlocal
|
|
|
|
|
chcp 65001 >nul
|
|
|
|
|
|
|
|
|
|
cd /d "%~dp0"
|
|
|
|
|
echo ============================================================
|
|
|
|
|
echo INV_WEB CLIENT AGENT INSTALLER WITH RUSTDESK
|
|
|
|
|
echo ============================================================
|
|
|
|
|
echo.
|
|
|
|
|
set "SPEC_FILE=client_agent_v2_windows_onefile.spec"
|
|
|
|
|
set "CLIENT_DIR=dist\Inv_web Client"
|
|
|
|
|
set "CLIENT_EXE=%CLIENT_DIR%\Inv_web Client.exe"
|
|
|
|
|
set "INSTALLER_SCRIPT=client_agent_v2_installer.iss"
|
|
|
|
|
set "RUSTDESK_INSTALLER=installer\prerequisites\rustdesk.exe"
|
|
|
|
|
set "ISCC=%ProgramFiles(x86)%\Inno Setup 6\ISCC.exe"
|
|
|
|
|
set "PYTHON_INSTALLER_VERSION=3.13.15"
|
|
|
|
|
set "PYTHON_INSTALLER_URL=https://www.python.org/ftp/python/3.13.15/python-3.13.15-amd64.exe"
|
|
|
|
|
set "PYTHON_INSTALLER_SHA256=edec09c4853aeae9ac36efb8c9f95b6b8e2fee65eee56d9767a8b7c69c574403"
|
|
|
|
|
set "PYTHON_INSTALLER_FILE=%TEMP%\inventera-python-3.13.15-amd64.exe"
|
|
|
|
|
set "PYTHON_INSTALLER_TARGET=%LocalAppData%\Programs\Python\Python313"
|
|
|
|
|
set "PYTHON_INSTALL_LOG=%TEMP%\inventera-python-3.13.15-install.log"
|
|
|
|
|
|
|
|
|
|
if not exist "%SPEC_FILE%" (
|
|
|
|
|
echo Spec file not found: %SPEC_FILE%
|
|
|
|
|
@@ -67,22 +77,24 @@ call :find_build_python
|
|
|
|
|
|
|
|
|
|
if not defined BUILD_PYTHON (
|
|
|
|
|
where winget >nul 2>nul
|
|
|
|
|
if errorlevel 1 (
|
|
|
|
|
echo.
|
|
|
|
|
echo ERROR: Classic Python 3.13 with Tcl/Tk is not installed.
|
|
|
|
|
echo Install it with Tcl/Tk support from: https://www.python.org/downloads/windows/
|
|
|
|
|
goto :fail
|
|
|
|
|
if not errorlevel 1 (
|
|
|
|
|
echo Classic Python 3.13 with Tcl/Tk was not found. Trying winget...
|
|
|
|
|
winget install --id Python.Python.3.13 -e --scope user --silent --accept-package-agreements --accept-source-agreements
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
echo Classic Python 3.13 with Tcl/Tk was not found. Installing it with winget...
|
|
|
|
|
winget install --id Python.Python.3.13 -e --scope user --silent --accept-package-agreements --accept-source-agreements
|
|
|
|
|
call :find_build_python
|
|
|
|
|
if not defined BUILD_PYTHON (
|
|
|
|
|
echo winget is unavailable or did not provide a usable Python with Tcl/Tk.
|
|
|
|
|
call :install_classic_python
|
|
|
|
|
if errorlevel 1 goto :fail
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
call :find_build_python
|
|
|
|
|
if not defined BUILD_PYTHON (
|
|
|
|
|
echo Python 3.13 was installed, but python.exe was not found in a standard location.
|
|
|
|
|
echo Check the Python installation or install Python 3.13 manually with Tcl/Tk support.
|
|
|
|
|
echo.
|
|
|
|
|
echo ERROR: Python 3.13 with a working Tcl/Tk runtime was not found after installation.
|
|
|
|
|
echo Python installer log: %PYTHON_INSTALL_LOG%
|
|
|
|
|
goto :fail
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@@ -167,31 +179,92 @@ exit /b 1
|
|
|
|
|
:find_build_python
|
|
|
|
|
set "BUILD_PYTHON="
|
|
|
|
|
|
|
|
|
|
if exist "%LocalAppData%\Programs\Python\Python313\python.exe" set "BUILD_PYTHON=%LocalAppData%\Programs\Python\Python313\python.exe"
|
|
|
|
|
if not defined BUILD_PYTHON if exist "%ProgramFiles%\Python313\python.exe" set "BUILD_PYTHON=%ProgramFiles%\Python313\python.exe"
|
|
|
|
|
call :try_build_python "%LocalAppData%\Programs\Python\Python313\python.exe"
|
|
|
|
|
call :try_build_python "%ProgramFiles%\Python313\python.exe"
|
|
|
|
|
|
|
|
|
|
if not defined BUILD_PYTHON (
|
|
|
|
|
for /d %%D in ("%LocalAppData%\Programs\Python\Python313*") do if exist "%%~fD\python.exe" set "BUILD_PYTHON=%%~fD\python.exe"
|
|
|
|
|
for /d %%D in ("%LocalAppData%\Programs\Python\Python313*") do call :try_build_python "%%~fD\python.exe"
|
|
|
|
|
)
|
|
|
|
|
if not defined BUILD_PYTHON (
|
|
|
|
|
for /d %%D in ("%ProgramFiles%\Python313*") do if exist "%%~fD\python.exe" set "BUILD_PYTHON=%%~fD\python.exe"
|
|
|
|
|
for /d %%D in ("%ProgramFiles%\Python313*") do call :try_build_python "%%~fD\python.exe"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if not defined BUILD_PYTHON (
|
|
|
|
|
for /f "tokens=2,*" %%A in ('reg query "HKCU\Software\Python\PythonCore\3.13\InstallPath" /v ExecutablePath 2^>nul') do if /I "%%A"=="REG_SZ" set "BUILD_PYTHON=%%B"
|
|
|
|
|
for /f "tokens=2,*" %%A in ('reg query "HKCU\Software\Python\PythonCore\3.13\InstallPath" /v ExecutablePath 2^>nul') do if /I "%%A"=="REG_SZ" call :try_build_python "%%B"
|
|
|
|
|
)
|
|
|
|
|
if not defined BUILD_PYTHON (
|
|
|
|
|
for /f "tokens=2,*" %%A in ('reg query "HKCU\Software\Python\PythonCore\3.13-64\InstallPath" /v ExecutablePath 2^>nul') do if /I "%%A"=="REG_SZ" set "BUILD_PYTHON=%%B"
|
|
|
|
|
for /f "tokens=2,*" %%A in ('reg query "HKCU\Software\Python\PythonCore\3.13-64\InstallPath" /v ExecutablePath 2^>nul') do if /I "%%A"=="REG_SZ" call :try_build_python "%%B"
|
|
|
|
|
)
|
|
|
|
|
if not defined BUILD_PYTHON (
|
|
|
|
|
for /f "tokens=2,*" %%A in ('reg query "HKLM\Software\Python\PythonCore\3.13\InstallPath" /v ExecutablePath 2^>nul') do if /I "%%A"=="REG_SZ" set "BUILD_PYTHON=%%B"
|
|
|
|
|
for /f "tokens=2,*" %%A in ('reg query "HKLM\Software\Python\PythonCore\3.13\InstallPath" /v ExecutablePath 2^>nul') do if /I "%%A"=="REG_SZ" call :try_build_python "%%B"
|
|
|
|
|
)
|
|
|
|
|
if not defined BUILD_PYTHON (
|
|
|
|
|
for /f "tokens=2,*" %%A in ('reg query "HKLM\Software\Python\PythonCore\3.13-64\InstallPath" /v ExecutablePath 2^>nul') do if /I "%%A"=="REG_SZ" set "BUILD_PYTHON=%%B"
|
|
|
|
|
for /f "tokens=2,*" %%A in ('reg query "HKLM\Software\Python\PythonCore\3.13-64\InstallPath" /v ExecutablePath 2^>nul') do if /I "%%A"=="REG_SZ" call :try_build_python "%%B"
|
|
|
|
|
)
|
|
|
|
|
if not defined BUILD_PYTHON (
|
|
|
|
|
for /f "delims=" %%I in ('py -3.13 -c "import sys; print(sys.executable)" 2^>nul') do set "BUILD_PYTHON=%%I"
|
|
|
|
|
for /f "delims=" %%I in ('py -3.13 -c "import sys; print(sys.executable)" 2^>nul') do call :try_build_python "%%I"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if defined BUILD_PYTHON if not exist "%BUILD_PYTHON%" set "BUILD_PYTHON="
|
|
|
|
|
exit /b 0
|
|
|
|
|
|
|
|
|
|
:try_build_python
|
|
|
|
|
if defined BUILD_PYTHON exit /b 0
|
|
|
|
|
if "%~1"=="" exit /b 0
|
|
|
|
|
if not exist "%~1" exit /b 0
|
|
|
|
|
|
|
|
|
|
"%~1" -c "import pathlib, sys, tkinter; assert sys.version_info[:2] == (3, 13); tcl = pathlib.Path(sys.base_prefix) / 'tcl'; assert list(tcl.glob('tcl*/init.tcl')); assert list(tcl.glob('tk*/tk.tcl')); print(tkinter.Tcl().eval('info patchlevel'))" >nul 2>nul
|
|
|
|
|
if not errorlevel 1 set "BUILD_PYTHON=%~1"
|
|
|
|
|
exit /b 0
|
|
|
|
|
|
|
|
|
|
:install_classic_python
|
|
|
|
|
echo.
|
|
|
|
|
echo Downloading official classic Python %PYTHON_INSTALLER_VERSION% x64 with Tcl/Tk...
|
|
|
|
|
if exist "%PYTHON_INSTALLER_FILE%" del /q "%PYTHON_INSTALLER_FILE%" >nul 2>nul
|
|
|
|
|
|
|
|
|
|
where curl.exe >nul 2>nul
|
|
|
|
|
if errorlevel 1 goto :download_python_with_powershell
|
|
|
|
|
|
|
|
|
|
curl.exe --fail --location --retry 3 --output "%PYTHON_INSTALLER_FILE%" "%PYTHON_INSTALLER_URL%"
|
|
|
|
|
if not errorlevel 1 goto :verify_python_installer
|
|
|
|
|
echo curl failed. Trying PowerShell download...
|
|
|
|
|
|
|
|
|
|
:download_python_with_powershell
|
|
|
|
|
powershell.exe -NoProfile -NonInteractive -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -UseBasicParsing -Uri $env:PYTHON_INSTALLER_URL -OutFile $env:PYTHON_INSTALLER_FILE"
|
|
|
|
|
if errorlevel 1 goto :python_download_failed
|
|
|
|
|
|
|
|
|
|
:verify_python_installer
|
|
|
|
|
if not exist "%PYTHON_INSTALLER_FILE%" goto :python_download_failed
|
|
|
|
|
|
|
|
|
|
set "DOWNLOADED_PYTHON_SHA256="
|
|
|
|
|
for /f "delims=" %%H in ('powershell.exe -NoProfile -NonInteractive -Command "(Get-FileHash -LiteralPath $env:PYTHON_INSTALLER_FILE -Algorithm SHA256).Hash" 2^>nul') do set "DOWNLOADED_PYTHON_SHA256=%%H"
|
|
|
|
|
|
|
|
|
|
if /I not "%DOWNLOADED_PYTHON_SHA256%"=="%PYTHON_INSTALLER_SHA256%" (
|
|
|
|
|
echo.
|
|
|
|
|
echo ERROR: The downloaded Python installer checksum is invalid.
|
|
|
|
|
echo Expected: %PYTHON_INSTALLER_SHA256%
|
|
|
|
|
echo Received: %DOWNLOADED_PYTHON_SHA256%
|
|
|
|
|
if exist "%PYTHON_INSTALLER_FILE%" del /q "%PYTHON_INSTALLER_FILE%" >nul 2>nul
|
|
|
|
|
exit /b 1
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
echo Installing classic Python %PYTHON_INSTALLER_VERSION% for the current user...
|
|
|
|
|
"%PYTHON_INSTALLER_FILE%" /quiet InstallAllUsers=0 TargetDir="%PYTHON_INSTALLER_TARGET%" AssociateFiles=0 PrependPath=0 Shortcuts=0 Include_launcher=0 Include_pip=1 Include_tcltk=1 Include_test=0 /log "%PYTHON_INSTALL_LOG%"
|
|
|
|
|
if errorlevel 1 goto :classic_python_install_failed
|
|
|
|
|
|
|
|
|
|
if exist "%PYTHON_INSTALLER_FILE%" del /q "%PYTHON_INSTALLER_FILE%" >nul 2>nul
|
|
|
|
|
exit /b 0
|
|
|
|
|
|
|
|
|
|
:python_download_failed
|
|
|
|
|
echo.
|
|
|
|
|
echo ERROR: Failed to download the official Python installer:
|
|
|
|
|
echo %PYTHON_INSTALLER_URL%
|
|
|
|
|
echo Check the Internet connection and run this BAT file again.
|
|
|
|
|
if exist "%PYTHON_INSTALLER_FILE%" del /q "%PYTHON_INSTALLER_FILE%" >nul 2>nul
|
|
|
|
|
exit /b 1
|
|
|
|
|
|
|
|
|
|
:classic_python_install_failed
|
|
|
|
|
echo.
|
|
|
|
|
echo ERROR: Classic Python installation failed.
|
|
|
|
|
echo Installer log: %PYTHON_INSTALL_LOG%
|
|
|
|
|
if exist "%PYTHON_INSTALLER_FILE%" del /q "%PYTHON_INSTALLER_FILE%" >nul 2>nul
|
|
|
|
|
exit /b 1
|
|
|
|
|
|