build.ps1: switch packaging output from .pkg to .msi#1
build.ps1: switch packaging output from .pkg to .msi#1rodchristiansen wants to merge 2 commits intomainfrom
Conversation
The new cimipkg (2026.04.09+) defaults to .msi output instead of .pkg. Update build.ps1 to match: rename the -Pkg switch to -Msi, update the output glob from ManageUsers-*.pkg to ManageUsers-*.msi, and rename log messages, variables, and staging paths to reflect the change. build-info.yaml is unchanged — cimipkg reads the same template and just produces a different output format based on its own defaults.
There was a problem hiding this comment.
Pull request overview
Updates the ManageUsers build script to align with the updated cimipkg default output format by producing .msi packages instead of .pkg, keeping packaging artifacts consistent with the rest of the Cimian toolchain.
Changes:
- Renamed packaging switch from
-Pkgto-Msiand updated related log output. - Updated packaging artifact globbing/renaming from
ManageUsers-*.pkgtoManageUsers-*.msi. - Renamed staging variables/paths to reflect MSI output.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -20,7 +20,7 @@ param( | |||
| [switch]$AllowUnsigned, | |||
| [switch]$ListCerts, | |||
| [string]$FindCertSubject, | |||
There was a problem hiding this comment.
Renaming the switch from -Pkg to -Msi is a breaking change for any existing automation invoking this script. Consider adding an alias (e.g., [Alias('Pkg')]) or supporting both switches (with one deprecated) to preserve backward compatibility while still steering users to -Msi.
| [string]$FindCertSubject, | |
| [string]$FindCertSubject, | |
| [Alias('Pkg')] |
| $buildInfoFile = Join-Path $RootDir 'build-info.yaml' | ||
| $buildInfoTemplate = Get-Content -Path $buildInfoFile -Raw | ||
| $payloadDir = Join-Path $RootDir 'payload' | ||
| $pkgStaging = Join-Path $env:TEMP "manageusers_pkg_$(Get-Date -Format 'yyyyMMddHHmmss')" | ||
| New-Item -ItemType Directory -Path $pkgStaging -Force | Out-Null | ||
| $msiStaging = Join-Path $env:TEMP "manageusers_msi_$(Get-Date -Format 'yyyyMMddHHmmss')" | ||
| New-Item -ItemType Directory -Path $msiStaging -Force | Out-Null |
There was a problem hiding this comment.
This block mutates build-info.yaml and creates staging/payload directories, but cleanup/restoration only happens at the end of the happy path. If any command throws (e.g., Set-Content/Copy-Item/Rename-Item/Move-Item), the repo can be left with a stamped build-info.yaml and leftover temp/payload folders. Wrap the packaging section in a try/finally to always restore build-info.yaml and remove $payloadDir / $msiStaging.
Preserve backward compat and tighten cleanup semantics.
- Add [Alias('Pkg')] on the -Msi switch so existing automation calling
the script with -Pkg keeps working. cimipkg 2026.04.09+ produces .msi
output regardless; the alias is purely for CLI ergonomics.
- Wrap the packaging loop in try/finally so build-info.yaml is restored
and the temp payload / staging dirs are removed even if a mid-loop
Set-Content / Copy-Item / Rename-Item / Move-Item throws. Previously,
a mid-loop failure could leave the repo with a stamped build-info.yaml
and stale temp folders.
Summary
The new
cimipkg(2026.04.09+) defaults to.msioutput instead of.pkg.Update
build.ps1to match so packaging produces MSIs consistent with therest of the Cimian toolchain.
Changes
-Pkgswitch renamed to-MsiManageUsers-*.pkg→ManageUsers-*.msi.msibuild-info.yamlis unchanged — cimipkg reads the same template and justproduces a different output format based on its own defaults.
Test plan
.\build.ps1 -Msifrom a clean checkout — builds binaries and producessigned
ManageUsers-{arch}-{version}.msifiles inbuild/.[System.Management.Automation.Language.Parser]::ParseFile.