vole
Site
Clone
Read only, no credentials:
https://rodent.software/vole.git
Write over SSH with a registered key:
git clone ssh://git@rodent.software/vole.git
Self-hosted forge that lives in your Git repo.
Package Windows: an MSI built with wixl, and install.ps1
31560d91c4e27f3fdee2652aa3b4b12b8343903d · Keenan Nemetz · 2d ago · parent 9cbfa891
Package Windows: an MSI built with wixl, and install.ps1 The Windows server installs from an MSI now, with install.ps1 on the channel as the one-command path, the same shape as the Linux installer. The MSI is built by wixl (msitools), not the WiX toolset. WiX v5 and v6 refuse to build outside Windows: every relative path is canonicalized against a hardcoded C:\ and the first Directory is rejected, so it cannot run in the release image. I tested both before choosing; wixl 0.101 is what Debian bookworm ships and it produces a package that installs, upgrades, and uninstalls on the Server Core guest. Its limits shaped the design and are recorded in the .wxs header: it silently drops Component/@Permanent and @NeverOverwrite, cannot edit PATH, and cannot schedule rollback actions, so the configuration and the data directory belong to `vole service install` and not to the package. That moved two things into the CLI. `service install` now writes a documented default configuration to %ProgramData%\Vole\vole.toml when it is given none, and initializes the instance database and repository like the Linux post-install step, so the package's only action is the binary registering itself. The same command serves a hand install and a pre-release, which has no MSI. The MSI's upgrade table is written by hand because wixl's MajorUpgrade schedules RemoveExistingProducts in the window Windows Installer rejects (error 2613). RemoveExistingProducts is placed at 1501, the service's stop-and-remove at 3400, and install-and-start after InstallFiles, so an upgrade removes the old product before the new files land and the running executable is never locked. Fixed along the way, found by installing the MSI: secure.HardenFor accepted an access list that was a subset of what it was asked to grant, so a configuration written by SYSTEM looked correct and never got the service account's entry; the service then could not read it and failed to start. HardenFor now requires every requested principal to be present, with a Windows test for the subset case. Release and verify wiring: both images gain wixl and msitools, verify builds the MSI and reads its tables back (wixl exits 0 when a source is missing), and the release builds the Windows binary and, for a stable tag, the MSI, and publishes install.ps1 beside install.sh. A pre-release tag has no MSI: ProductVersion cannot carry a pre-release suffix and wixl cannot express the same-version upgrade, so those releases ship the binary and install.ps1 says so. Docs: install.md gains the Windows method, packaging.md the Windows package and its limits, deploying windows.md the packaged flow (install, configure, first admin, firewall, upgrade, binary fallback, troubleshooting), and RELEASING.md the Windows sign-off a Linux runner cannot perform. Verified on the Server Core 2022 guest: MSI install starts the service and serves HTTP 200, with the config created at the documented default and the data kept; 0.2.1 upgrades over 0.2.0 with one Programs-and-Features entry and the service running; uninstall removes the service and the binary and leaves the config, data, and a marker file; install.ps1 installs from a local mirror after checking SHA256SUMS; reinstall and uninstall are repeatable. Windows unit tests pass there, and `vole workflow run verify` passes locally including the new package step. Part of 01M8SE6GWX1DGYPY6H9YC142C2.
packaging/windows/vole.wxs +94
| @@ -0,0 +1,94 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <!-- | ||
| 3 | The Windows package. | ||
| 4 | |||
| 5 | Built with wixl (msitools), not the WiX toolset: WiX v5 and v6 refuse to build | ||
| 6 | an MSI anywhere but Windows (every relative path is canonicalized against a | ||
| 7 | hardcoded "C:\"), and the release workflow runs on a Linux runner. wixl | ||
| 8 | implements the WiX v3 schema, which is why this file uses it. Three of wixl | ||
| 9 | 0.101's limits shape the package below: | ||
| 10 | |||
| 11 | - Component/@Permanent and @NeverOverwrite are silently ignored, so nothing | ||
| 12 | that has to survive an uninstall may be an MSI file. The configuration and | ||
| 13 | the data directory are created by `vole service install`, not by this | ||
| 14 | package. | ||
| 15 | - Environment elements on a component are unhandled, so the package does not | ||
| 16 | edit PATH; docs/deploy/windows.md says how to add it by hand. | ||
| 17 | - Execute="rollback" is emitted as an ordinary deferred action, so it cannot | ||
| 18 | be used. The service is installed by the binary's own idempotent command, | ||
| 19 | and uninstall removes it before the files go away. | ||
| 20 | |||
| 21 | Paths are resolved against the working directory, not this file, so the build | ||
| 22 | runs from the repository root: | ||
| 23 | |||
| 24 | wixl -a x64 -D Version=0.2.0 -o dist/vole-windows-amd64.msi \ | ||
| 25 | packaging/windows/vole.wxs | ||
| 26 | |||
| 27 | wixl logs a GLib CRITICAL and writes an MSI with no files when a source is | ||
| 28 | missing, so the verify and release steps read the File table back instead of | ||
| 29 | trusting the exit status. | ||
| 30 | --> | ||
| 31 | <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> | ||
| 32 | <Product Id="*" Name="Vole" Language="1033" Version="$(var.Version)" | ||
| 33 | Manufacturer="Rodent Software" UpgradeCode="2F8C1B0A-9D34-4E6B-8B7E-0F5D9C3A7E21"> | ||
| 34 | <Package InstallerVersion="500" Compressed="yes" InstallScope="perMachine" /> | ||
| 35 | <MediaTemplate EmbedCab="yes" /> | ||
| 36 | |||
| 37 | <!-- The upgrade table is written by hand because wixl 0.101's MajorUpgrade | ||
| 38 | schedules RemoveExistingProducts after InstallValidate and before | ||
| 39 | InstallInitialize, a window Windows Installer rejects with error 2613. | ||
| 40 | The sequence entry below places it after InstallInitialize instead: the | ||
| 41 | old product is removed — stopping its service — before the new files are | ||
| 42 | copied, which is what keeps the running executable unlocked. --> | ||
| 43 | <Upgrade Id="2F8C1B0A-9D34-4E6B-8B7E-0F5D9C3A7E21"> | ||
| 44 | <UpgradeVersion Minimum="0.0.0" Maximum="$(var.Version)" IncludeMinimum="yes" | ||
| 45 | IncludeMaximum="no" Property="WIX_UPGRADE_DETECTED" /> | ||
| 46 | <UpgradeVersion Minimum="$(var.Version)" IncludeMinimum="yes" OnlyDetect="yes" | ||
| 47 | Property="WIX_DOWNGRADE_DETECTED" /> | ||
| 48 | </Upgrade> | ||
| 49 | <Condition Message="A newer version of Vole is already installed.">NOT WIX_DOWNGRADE_DETECTED</Condition> | ||
| 50 | |||
| 51 | <Directory Id="TARGETDIR" Name="SourceDir"> | ||
| 52 | <Directory Id="ProgramFiles64Folder"> | ||
| 53 | <Directory Id="INSTALLFOLDER" Name="Vole" /> | ||
| 54 | </Directory> | ||
| 55 | </Directory> | ||
| 56 | |||
| 57 | <DirectoryRef Id="INSTALLFOLDER"> | ||
| 58 | <Component Id="VoleExe" Guid="6B1C2E44-48B5-4C39-9C5D-1B7E9A6F2D10"> | ||
| 59 | <File Id="VoleExeFile" Source="dist/vole-windows-amd64.exe" Name="vole.exe" KeyPath="yes" /> | ||
| 60 | </Component> | ||
| 61 | <Component Id="Docs" Guid="A4D3C9B2-7F61-4E28-B3A9-5C0E8D2F1B47"> | ||
| 62 | <File Id="LicenseFile" Source="LICENSE" KeyPath="yes" /> | ||
| 63 | <File Id="NoticeFile" Source="NOTICE" /> | ||
| 64 | </Component> | ||
| 65 | </DirectoryRef> | ||
| 66 | |||
| 67 | <Feature Id="Main"> | ||
| 68 | <ComponentRef Id="VoleExe" /> | ||
| 69 | <ComponentRef Id="Docs" /> | ||
| 70 | </Feature> | ||
| 71 | |||
| 72 | <!-- The service is registered by the binary, so the MSI, the script, and a | ||
| 73 | hand-run install share one definition of the account, the recovery | ||
| 74 | actions, and the command line. FileKey names the file just installed; | ||
| 75 | no formatted properties are needed, which deferred actions cannot see. --> | ||
| 76 | <CustomAction Id="ServiceInstall" FileKey="VoleExeFile" ExeCommand="service install" | ||
| 77 | Execute="deferred" Impersonate="no" Return="check" /> | ||
| 78 | <CustomAction Id="ServiceStart" FileKey="VoleExeFile" ExeCommand="service start" | ||
| 79 | Execute="deferred" Impersonate="no" Return="ignore" /> | ||
| 80 | <CustomAction Id="ServiceUninstall" FileKey="VoleExeFile" ExeCommand="service uninstall" | ||
| 81 | Execute="deferred" Impersonate="no" Return="ignore" /> | ||
| 82 | |||
| 83 | <InstallExecuteSequence> | ||
| 84 | <!-- Sequence numbers rather than After/Before: wixl's dependency placement | ||
| 85 | leaves RemoveExistingProducts behind InstallFiles and this action at | ||
| 86 | sequence 1, where a deferred action outside the transaction is at best | ||
| 87 | unexplained. These are the slots WiX uses for the same arrangement. --> | ||
| 88 | <Custom Action="RemoveExistingProducts" Sequence="1501" /> | ||
| 89 | <Custom Action="ServiceUninstall" Sequence="3400">REMOVE="ALL"</Custom> | ||
| 90 | <Custom Action="ServiceInstall" Sequence="4001">NOT Installed</Custom> | ||
| 91 | <Custom Action="ServiceStart" Sequence="4002">NOT Installed</Custom> | ||
| 92 | </InstallExecuteSequence> | ||
| 93 | </Product> | ||
| 94 | </Wix> | ||