Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example CLM support #786

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 49 additions & 2 deletions Sources/Wix/build.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@
<Property Id="APPINSTALLERSHORTCUT_VALUE" Value="#0">
<RegistrySearch Id="SearchAppInstallerShortcut" Type="raw" Root="HKLM" Key="SOFTWARE\[Manufacturer]\[ProductName]" Name="WAU_AppInstallerShortcut" />
</Property>
<!-- Install path with backicks for powershell CLM -->

<!-- Create EscapedInstallPath using installdir and replacing the spaces with backtick escaped version -->
<!-- <Property Id="EscapedInstallPath" Value="[INSTALLDIR].replace(/ /g, ' `')"></Property> -->

<!-- UI Config -->
<UI Id="WixUI_InstallDir">
Expand Down Expand Up @@ -262,8 +266,51 @@
<SetProperty Id="MAXLOGSIZE_VALUE" After="AppSearch" Value="#[MAXLOGSIZE]" Condition="MAXLOGSIZE" />
<SetProperty Action="SetUPDATEPRERELEASE_0" Id="UPDATEPRERELEASE" After="AppSearch" Value="0" Condition="(NOT UPDATEPRERELEASE) AND (UPDATEPRERELEASE_VALUE &lt;&gt; &quot;#1&quot;)" />
<SetProperty Action="SetUPDATEPRERELEASE_1" Id="UPDATEPRERELEASE" After="AppSearch" Value="1" Condition="(NOT UPDATEPRERELEASE) AND (UPDATEPRERELEASE_VALUE = &quot;#1&quot;)" />
<SetProperty Id="CA_PowerShell_Install" Before="CA_PowerShell_Install" Sequence="execute" Value="&quot;[POWERSHELLEXE]&quot; -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -File &quot;[INSTALLDIR]config\WAU-MSI_Actions.ps1&quot; &quot;[B_W_LIST_PATH]&quot; -InstallPath &quot;[INSTALLDIR]\&quot; -CurrentDir &quot;[CURRENTDIRECTORY]&quot;" />
<SetProperty Id="CA_PowerShell_Uninstall" Before="CA_PowerShell_Uninstall" Sequence="execute" Value="&quot;[POWERSHELLEXE]&quot; -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -File &quot;[INSTALLDIR]config\WAU-MSI_Actions.ps1&quot; &quot;[B_W_LIST_PATH]&quot; -InstallPath &quot;[INSTALLDIR]\&quot; -Upgrade &quot;#[UPGRADINGPRODUCTCODE]&quot; -Uninstall" />

<!-- <SetProperty Id="EscapedInstallPath" Before="CA_PowerShell_Install" Sequence="execute" Value="[INSTALLDIR].replace(/ /g, '` ')"/> -->


<!--
<SetProperty
Id="CA_PowerShell_Install"
Before="CA_PowerShell_Install"
Sequence="execute"
Value="&quot;[POWERSHELLEXE]&quot;
-NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -Command
&quot;&amp; &amp;#123;
&amp;
&apos;[INSTALLDIR]\config\WAU-MSI_Actions.ps1&apos;
&apos;[B_W_LIST_PATH]&apos;
-InstallPath &apos;[INSTALLDIR]\&apos;
-CurrentDir &apos;[CURRENTDIRECTORY]&apos;
&amp;#125; &quot; "
&quot;&amp; {{
&amp;
&apos;[INSTALLDIR]\config\WAU-MSI_Actions.ps1&apos;
&apos;[B_W_LIST_PATH]&apos;
-InstallPath &apos;[INSTALLDIR]\&apos;
-Uninstall
}}&quot; "
/>
-->
<SetProperty
Id="CA_PowerShell_Install"
Before="CA_PowerShell_Install"
Sequence="execute"
Value="&quot;[POWERSHELLEXE]&quot; -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -Command &quot;&amp; [\{]
&amp; &apos;[INSTALLDIR]\config\WAU-MSI_Actions.ps1&apos; &apos;[B_W_LIST_PATH]&apos; -InstallPath &apos;[INSTALLDIR]&apos; -CurrentDir &apos;[CURRENTDIRECTORY]&apos;
[\}] &quot;"
/>


<SetProperty
Id="CA_PowerShell_Uninstall"
Before="CA_PowerShell_Uninstall"
Sequence="execute"
Value="&quot;[POWERSHELLEXE]&quot; -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -Command &quot;&amp; [\{]
&amp; &apos;[INSTALLDIR]\config\WAU-MSI_Actions.ps1&apos; &apos;[B_W_LIST_PATH]&apos; -InstallPath &apos;[INSTALLDIR]&apos; -Uninstall
[\}] &quot;"
/>

<!-- Custom Actions -->
<CustomAction Id="StartWAU" Impersonate="yes" ExeCommand="conhost.exe --headless schtasks /run /tn WAU\Winget-AutoUpdate" Directory="INSTALLDIR" Return="ignore" />
Expand Down
33 changes: 33 additions & 0 deletions Sources/Wix/build_wix.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This is a script to run the wix build.wxs file to create an installer.
# This expects the context to be the wix directory and the build.wxs file to be in the same directory as this script.

# Once the .NET SDK and WIX proper are installed, the following commands can be run to build the installer
# wix extension add WixToolset.UI.wixext
# wix extension add WixToolset.Util.wixext

# First sign all resources under the source directory
# Get my certificate thumbprint
$cert = Get-ChildItem -Path Cert:\CurrentUser\My -CodeSigningCert | Select-Object -First 1
# Now get the winget-autoupdate directory and sign all files

$wingetFiles = Get-ChildItem -Path ..\ -Recurse -File -Include *.exe, *.dll, *.ps1, *.psm1, *.psd1, *.ps1xml

foreach ($file in $wingetFiles) {
Set-AuthenticodeSignature -FilePath $file.FullName -Certificate $cert -TimestampServer "http://timestamp.digicert.com"
}
Start-Sleep 3
$release = [int] ( Import-Clixml -Path .\release.xml )
$release += 1
$release | Export-Clixml -Path .\release.xml
$OutputFile = ".\WAU.msi"
$BuildVersion = "2.1.1.$release"

$Comment = "Custom Build for CLM"
wix build .\build.wxs -d Version="$BuildVersion" -d Comment="$Comment" -d PreRelease="False" -d NextSemVer="False" -o $OutputFile -arch x64 -ext WixToolset.UI.wixext -ext WixToolset.Util.wixext

# Now sign the output MSI for completeness
Set-AuthenticodeSignature -FilePath $OutputFile -Certificate $cert -TimestampServer "http://timestamp.digicert.com"

Copy-Item $OutputFile "\\$($env:TestComputer)\temp\WAU_TEST" -Verbose


Binary file added Sources/Wix/release.xml
Binary file not shown.