From 31aec940081c5c6ec06e767e4c408dcac20656a0 Mon Sep 17 00:00:00 2001 From: Alexandr Stelnykovych Date: Fri, 17 Oct 2025 21:53:50 +0300 Subject: [PATCH] Build scripts refactoring --- Earthfile | 3 +- .../windows/generate_windows_installers.ps1 | 28 +++++++++++-------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Earthfile b/Earthfile index 91222ebd..65b5d62c 100644 --- a/Earthfile +++ b/Earthfile @@ -555,7 +555,8 @@ release-prep: RUN --no-cache echo "[ !!! ATTENTION !!! ] PRECOMPILED FILES IN USE:" && find ./packaging/precompiled -type f; IF --no-cache [ -d ./packaging/precompiled/intel ] RUN --no-cache echo "[!!! ATTENTION !!!] ENSURE THAT 'intel/index.json' CONTAINS THE CORRECT HASHES!" - END + END + RUN --no-cache echo "Script paused. Press Enter to continue..." && read SAVE ARTIFACT --if-exists --keep-ts "packaging/precompiled/intel/*" AS LOCAL "${outputDir}/intel/" # save to host SAVE ARTIFACT --if-exists --keep-ts "packaging/precompiled/binary/*" AS LOCAL "${outputDir}/binary/" # save to host SAVE ARTIFACT --if-exists --keep-ts "packaging/precompiled/intel/*" "output/intel/" # save to container (so other containers can access it) diff --git a/packaging/windows/generate_windows_installers.ps1 b/packaging/windows/generate_windows_installers.ps1 index 31c5ed40..a8fea2f9 100644 --- a/packaging/windows/generate_windows_installers.ps1 +++ b/packaging/windows/generate_windows_installers.ps1 @@ -9,6 +9,9 @@ # 1. Compile Core Binaries (Linux environment) # ``` # earthly +release-prep +# +# # Or use command to do the same AND build Linux packages: +# # earthly +all-artifacts # ``` # This compiles and places files into the 'dist' folder with the required structure. # Note: Latest KEXT binaries and Intel data will be downloaded from https://updates.safing.io @@ -20,7 +23,7 @@ # # 3. Sign All Binaries (Windows environment) # ``` -# .\packaging\windows\sign_binaries_in_dist.ps1 -certSha1 +# .\packaging\windows\sign_binaries_in_dist.ps1 -certSha1 d3bf5973eb1ec3dbd6ec45d77d556881a350acd2 # ``` # This signs all binary files in the dist directory # @@ -121,13 +124,14 @@ function Find-And-Copy-File { try { # Print details about the file - $fileInfo = Get-Item -Path $fullSourcePath - $output = "{0,-22}: {1,-29} -> {2,-38} [{3,-20} {4,18}{5}]" -f + $fileInfo = Get-Item -Path $fullSourcePath + $fileHash = (Get-FileHash -Path $fullSourcePath -Algorithm SHA256).Hash + $hashShort = $fileHash.Substring(0, 4) + "..." + $fileHash.Substring($fileHash.Length - 8) + $output = "{0,-22}: {1,-29} -> {2,-38} [{3}{4}]" -f $File, $(Split-Path -Path $fullSourcePath -Parent), $(Split-Path -Path $destinationPath -Parent), - "$($fileInfo.LastAccessTime.ToString("yyyy-MM-dd HH:mm:ss"));", - "$($fileInfo.Length) bytes", + "SHA256: $hashShort", $(if ($fileInfo.VersionInfo.FileVersion) { "; v$($fileInfo.VersionInfo.FileVersion)" } else { "" }) Write-Output "$output" @@ -205,13 +209,13 @@ try { # Copying BINARY FILES Write-Output "`n[+] Copying binary files:" $filesToCopy = @( - @{Folder="dist/binary/windows_amd64"; File="portmaster-kext.sys"; Destination=$binaryDir; AlternateSourceDirs=@("dist/downloaded/windows_amd64", "dist")}, - @{Folder="dist/binary/windows_amd64"; File="portmaster-core.dll"; Destination=$binaryDir; AlternateSourceDirs=@("dist/downloaded/windows_amd64", "dist")}, - @{Folder="dist/binary/windows_amd64"; File="portmaster-core.exe"; Destination=$binaryDir; AlternateSourceDirs=@("dist")}, - @{Folder="dist/binary/windows_amd64"; File="WebView2Loader.dll"; Destination=$binaryDir; AlternateSourceDirs=@("dist")}, - @{Folder="dist/binary/all"; File="portmaster.zip"; Destination=$binaryDir; AlternateSourceDirs=@("dist")}, - @{Folder="dist/binary/all"; File="assets.zip"; Destination=$binaryDir; AlternateSourceDirs=@("dist")}, - @{Folder="dist/binary/windows_amd64"; File="portmaster.exe"; Destination=$targetDir; AlternateSourceDirs=@("dist")} + @{Folder="dist/downloaded/windows_amd64"; File="portmaster-kext.sys"; Destination=$binaryDir; }, + @{Folder="dist/downloaded/windows_amd64"; File="portmaster-core.dll"; Destination=$binaryDir; }, + @{Folder="dist/binary/windows_amd64"; File="portmaster-core.exe"; Destination=$binaryDir; }, + @{Folder="dist/binary/windows_amd64"; File="WebView2Loader.dll"; Destination=$binaryDir; }, + @{Folder="dist/binary/all"; File="portmaster.zip"; Destination=$binaryDir; }, + @{Folder="dist/binary/all"; File="assets.zip"; Destination=$binaryDir; }, + @{Folder="dist/binary/windows_amd64"; File="portmaster.exe"; Destination=$targetDir; } ) foreach ($file in $filesToCopy) { Find-And-Copy-File -SourceDir $file.Folder -File $file.File -DestinationDir $file.Destination -AlternateSourceDirs $file.AlternateSourceDirs