diff --git a/packaging/windows/generate_windows_installers.ps1 b/packaging/windows/generate_windows_installers.ps1 index ffa03cec..f55f0d89 100644 --- a/packaging/windows/generate_windows_installers.ps1 +++ b/packaging/windows/generate_windows_installers.ps1 @@ -1,3 +1,11 @@ +# Tested with docker image 'abrarov/msvc-2022:latest' +# sha256:f49435d194108cd56f173ad5bc6a27c70eed98b7e8cd54488f5acd85efbd51c9 + +# Run: +# Start powershell and cd to the root of the project. Then run: +# $path = Convert-Path . # Get the absolute path of the current directory +# docker run -it --rm -v "${path}:C:/app" -w "C:/app" abrarov/msvc-2022 powershell -NoProfile -File C:/app/packaging/windows/generate_windows_installer.ps1 + # Save the current directory $originalDirectory = Get-Location @@ -10,7 +18,7 @@ if (-not (Test-Path -Path $binaryDir)) { New-Item -ItemType Directory -Path $binaryDir > $null } -# Copy binary files +Write-Output "Copying binary files" Copy-Item -Force -Path "dist/binary/bin-index.json" -Destination "$binaryDir/bin-index.json" Copy-Item -Force -Path "dist/binary/windows_amd64/portmaster-core.exe" -Destination "$binaryDir/portmaster-core.exe" Copy-Item -Force -Path "dist/binary/windows_amd64/portmaster-kext.sys" -Destination "$binaryDir/portmaster-kext.sys" @@ -22,17 +30,28 @@ Copy-Item -Force -Path "dist/binary/windows_amd64/portmaster.exe" -Destination " if (-not (Test-Path -Path $intelDir)) { New-Item -ItemType Directory -Path $intelDir > $null } -# Copy intel data + +Write-Output "Copying intel files" Copy-Item -Force -Path "dist/intel_decompressed/*" -Destination "$intelDir/" Set-Location $destinationDir -# Download tauri-cli +if (-not (Get-Command cargo -ErrorAction SilentlyContinue)) { + Write-Output "Installing rust toolchain..." + Invoke-WebRequest -Uri https://win.rustup.rs/x86_64 -OutFile rustup.exe + ./rustup.exe install stable + $env:PATH += ";C:\Users\ContainerAdministrator\.rustup\toolchains\stable-x86_64-pc-windows-msvc\bin\" +} else { + Write-Output "'cargo' command is already available" +} + +Write-Output "Downloading tauri-cli" Invoke-WebRequest -Uri https://github.com/tauri-apps/tauri/releases/download/tauri-cli-v2.0.1/cargo-tauri-x86_64-pc-windows-msvc.zip -OutFile tauri-cli.zip Expand-Archive -Force tauri-cli.zip - ./tauri-cli/cargo-tauri.exe bundle + +Write-Output "Copying generated bundles" $installerDist = "..\..\..\dist\windows_amd64\" # Make sure distination folder exists. if (-not (Test-Path -Path $installerDist)) {