Skip to content

Commit

Permalink
installer: add validation for EXTRA_FLAGS
Browse files Browse the repository at this point in the history
Signed-off-by: Jan-Otto Kröpke <[email protected]>
  • Loading branch information
jkroepke committed Feb 2, 2025
1 parent 71ec0bd commit 94184e2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion installer/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Copy-Item -Force $PathToExecutable Work/windows_exporter.exe
Write-Verbose "Creating windows_exporter-${Version}-${Arch}.msi"
$wixArch = @{"amd64" = "x64"; "arm64" = "arm64"}[$Arch]

Invoke-Expression "wix build -arch $wixArch -o .\windows_exporter-$($Version)-$($Arch).msi .\files.wxs .\main.wxs -d ProductName=windows_exporter -d Version=$($MsiVersion) -ext WixToolset.Firewall.wixext -ext WixToolset.UI.wixext -ext WixToolset.Util.wixext"
Invoke-Expression "wix build -sw1149 -arch $wixArch -o .\windows_exporter-$($Version)-$($Arch).msi .\files.wxs .\main.wxs -d ProductName=windows_exporter -d Version=$($MsiVersion) -ext WixToolset.Firewall.wixext -ext WixToolset.UI.wixext -ext WixToolset.Util.wixext"

Write-Verbose "Done!"
Pop-Location
6 changes: 6 additions & 0 deletions installer/main.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
Property="OLDERVERSIONBEINGUPGRADED" />
</Upgrade>

<CustomAction Id="CheckExtraFlags"
Error="The parameter '--config.file' must not be included in EXTRA_FLAGS. Use CONFIG_FILE instead. Please remove it and try again." />

<CustomAction Id="set_maintenance" Property="MAINTENANCE" Value="true" />

<!-- Set to reinstall all features. -->
Expand Down Expand Up @@ -97,6 +100,9 @@
<Custom Action="set_reinstallmode_property" Before="LaunchConditions" Condition="MAINTENANCE"/>
<Custom Action="CreateConfigFile" Before="InstallServices" Condition="ConfigFile_NonDefault OR ConfigFile_Default" />
<Custom Action="KillProcess" Before="RemoveFiles" />

<Custom Action="CheckExtraFlags" Before="InstallInitialize"
Condition="EXTRA_FLAGS AND (EXTRA_FLAGS&gt;&lt;&quot;--config.file&quot;)" />
</InstallExecuteSequence>

<Media Id="1" Cabinet="windows_exporter.cab" EmbedCab="yes" />
Expand Down

0 comments on commit 94184e2

Please sign in to comment.