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

feat: customize msi installer #1005

Open
wants to merge 1 commit 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
5 changes: 5 additions & 0 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@
"publisher": "Tari Labs, LLC",
"macOS": {
"providerShortName": "Tari Labs, LLC"
},
"windows": {
"wix": {
"template": "./wix/custom.wxs"
}
}
},
"macOSPrivateApi": true
Expand Down
Binary file added src-tauri/wix/bmp16x16.bmp
Binary file not shown.
Binary file added src-tauri/wix/bmp32x32.bmp
Binary file not shown.
Binary file added src-tauri/wix/bmp493x312.bmp
Binary file not shown.
Binary file added src-tauri/wix/bmp493x58.bmp
Binary file not shown.
215 changes: 215 additions & 0 deletions src-tauri/wix/custom.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
<?if $(sys.BUILDARCH)="x86"?>
<?define Win64 = "no" ?>
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
<?elseif $(sys.BUILDARCH)="x64"?>
<?define Win64 = "yes" ?>
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<?elseif $(sys.BUILDARCH)="arm64"?>
<?define Win64 = "yes" ?>
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<?else?>
<?error Unsupported value of sys.BUILDARCH=$(sys.BUILDARCH)?>
<?endif?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product
Id="*"
Name="Tari Universe (Alpha)"
UpgradeCode="ed60939d-f2b8-5b6e-a7af-bd0d5cf13e37"
Language="!(loc.TauriLanguage)"
Manufacturer="Tari Labs, LLC"
Version="0.5.55">

<Package Id="*"
Keywords="Installer"
InstallerVersion="450"
Languages="0"
Compressed="yes"
InstallScope="perMachine"
SummaryCodepage="!(loc.TauriCodepage)"/>

<!-- https://docs.microsoft.com/en-us/windows/win32/msi/reinstallmode -->
<!-- reinstall all files; rewrite all registry entries; reinstall all shortcuts -->
<Property Id="REINSTALLMODE" Value="amus" />

<!-- Auto launch app after installation, useful for passive mode which usually used in updates -->
<Property Id="AUTOLAUNCHAPP" Secure="yes" />
<!-- Property to forward cli args to the launched app to not lose those of the pre-update instance -->
<Property Id="LAUNCHAPPARGS" Secure="yes" />

<MajorUpgrade Schedule="afterInstallInitialize" AllowDowngrades="yes" />

<InstallExecuteSequence>
<RemoveShortcuts>Installed AND NOT UPGRADINGPRODUCTCODE</RemoveShortcuts>
</InstallExecuteSequence>

<Media Id="1" Cabinet="app.cab" EmbedCab="yes" />


<Icon Id="ProductIcon" SourceFile="C:\Users\barto\Desktop\tari\universe\src-tauri\target\release\resources\icon.ico"/>
<!-- <Icon Id="CustomIcon" SourceFile="C:\Users\barto\Desktop\tari\universe\src-tauri\wix\bmp.bmp"/> -->

<Property Id="ARPPRODUCTICON" Value="ProductIcon" />
<WixVariable Id="WixUIBannerBmp" Value="C:\Users\barto\Desktop\tari\universe\src-tauri\wix\bmp493x58.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="C:\Users\barto\Desktop\tari\universe\src-tauri\wix\bmp493x312.bmp" />
<!-- <WixVariable Id="WixUIExclamationIco" Value="C:\Users\barto\Desktop\tari\universe\src-tauri\wix\bmp32x32.bmp" />
<WixVariable Id="WixUIInfoIco" Value="C:\Users\barto\Desktop\tari\universe\src-tauri\wix\bmp32x32.bmp" />
<WixVariable Id="WixUINewIco" Value="C:\Users\barto\Desktop\tari\universe\src-tauri\wix\bmp16x16.bmp" />
<WixVariable Id="WixUIUpIco" Value="C:\Users\barto\Desktop\tari\universe\src-tauri\wix\bmp16x16.bmp" /> -->
<Property Id="ARPNOREPAIR" Value="yes" Secure="yes" /> <!-- Remove repair -->
<SetProperty Id="ARPNOMODIFY" Value="1" After="InstallValidate" Sequence="execute"/>

<!-- initialize with previous InstallDir -->
<Property Id="INSTALLDIR">
<RegistrySearch Id="PrevInstallDirReg" Root="HKCU" Key="Software\Tari Labs, LLC\Tari Universe (Alpha)" Name="InstallDir" Type="raw"/>
</Property>

<!-- launch app checkbox -->
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="!(loc.LaunchApp)" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1"/>
<CustomAction Id="LaunchApplication" Impersonate="yes" FileKey="Path" ExeCommand="[LAUNCHAPPARGS]" Return="asyncNoWait" />

<UI>
<!-- launch app checkbox -->
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>

<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />

<!-- Skip license dialog -->
<Publish Dialog="WelcomeDlg"
Control="Next"
Event="NewDialog"
Value="InstallDirDlg"
Order="2">1</Publish>
<Publish Dialog="InstallDirDlg"
Control="Back"
Event="NewDialog"
Value="WelcomeDlg"
Order="2">1</Publish>
</UI>

<UIRef Id="WixUI_InstallDir" />

<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="DesktopFolder" Name="Desktop">
<Component Id="ApplicationShortcutDesktop" Guid="*">
<Shortcut Id="ApplicationDesktopShortcut" Name="Tari Universe (Alpha)" Description="Runs Tari Universe (Alpha)" Target="[!Path]" WorkingDirectory="INSTALLDIR" />
<RemoveFolder Id="DesktopFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\Tari Labs, LLC\Tari Universe (Alpha)" Name="Desktop Shortcut" Type="integer" Value="1" KeyPath="yes" />
</Component>
</Directory>
<Directory Id="$(var.PlatformProgramFilesFolder)" Name="PFiles">
<Directory Id="INSTALLDIR" Name="Tari Universe (Alpha)"/>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="Tari Universe (Alpha)"/>
</Directory>
</Directory>

<DirectoryRef Id="INSTALLDIR">
<Component Id="RegistryEntries" Guid="*">
<RegistryKey Root="HKCU" Key="Software\Tari Labs, LLC\Tari Universe (Alpha)">
<RegistryValue Name="InstallDir" Type="string" Value="[INSTALLDIR]" KeyPath="yes" />
</RegistryKey>
</Component>
<Component Id="Path" Guid="c77f799e-2e72-5e65-a532-882f0f1af8ac" Win64="$(var.Win64)">
<File Id="Path" Source="C:\Users\barto\Desktop\tari\universe\src-tauri\target\release\Tari Universe (Alpha).exe" KeyPath="yes" Checksum="yes"/>
</Component>

<Component Id="CMP_UninstallShortcut" Guid="*">

<Shortcut Id="UninstallShortcut"
Name="Uninstall Tari Universe (Alpha)"
Description="Uninstalls Tari Universe (Alpha)"
Target="[System64Folder]msiexec.exe"
Arguments="/x [ProductCode]" />

<RemoveFolder Id="INSTALLDIR"
On="uninstall" />

<RegistryValue Root="HKCU"
Key="Software\Tari Labs, LLC\Tari Universe (Alpha)"
Name="Uninstaller Shortcut"
Type="integer"
Value="1"
KeyPath="yes" />
</Component>
</DirectoryRef>

<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="*">
<Shortcut Id="ApplicationStartMenuShortcut"
Name="Tari Universe (Alpha)"
Description="Runs Tari Universe (Alpha)"
Target="[!Path]"
Icon="ProductIcon"
WorkingDirectory="INSTALLDIR">
<ShortcutProperty Key="System.AppUserModel.ID" Value="com.tari.universe.alpha"/>
</Shortcut>
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\Tari Labs, LLC\Tari Universe (Alpha)" Name="Start Menu Shortcut" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>

<Feature
Id="MainProgram"
Title="Application"
Description="!(loc.InstallAppFeature)"
Level="1"
ConfigurableDirectory="INSTALLDIR"
AllowAdvertise="no"
Display="expand"
Absent="disallow">

<ComponentRef Id="RegistryEntries"/>


<Feature Id="ShortcutsFeature"
Title="Shortcuts"
Level="1">
<ComponentRef Id="Path"/>
<ComponentRef Id="CMP_UninstallShortcut" />
<ComponentRef Id="ApplicationShortcut" />
<ComponentRef Id="ApplicationShortcutDesktop" />
</Feature>

<Feature
Id="Environment"
Title="PATH Environment Variable"
Description="!(loc.PathEnvVarFeature)"
Level="1"
Absent="allow">
<ComponentRef Id="Path"/>
</Feature>
</Feature>

<Feature Id="External" AllowAdvertise="no" Absent="disallow">
</Feature>

<!-- WebView2 -->
<Property Id="WVRTINSTALLED">
<RegistrySearch Id="WVRTInstalledSystem" Root="HKLM" Key="SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" Name="pv" Type="raw" Win64="no" />
<RegistrySearch Id="WVRTInstalledUser" Root="HKCU" Key="SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" Name="pv" Type="raw"/>
</Property>

<CustomAction Id='DownloadAndInvokeBootstrapper' Directory="INSTALLDIR" Execute="deferred" ExeCommand='powershell.exe -NoProfile -windowstyle hidden try [\{] [\[]Net.ServicePointManager[\]]::SecurityProtocol = [\[]Net.SecurityProtocolType[\]]::Tls12 [\}] catch [\{][\}]; Invoke-WebRequest -Uri "https://go.microsoft.com/fwlink/p/?LinkId=2124703" -OutFile "$env:TEMP\MicrosoftEdgeWebview2Setup.exe" ; Start-Process -FilePath "$env:TEMP\MicrosoftEdgeWebview2Setup.exe" -ArgumentList (&apos;/silent&apos;, &apos;/install&apos;) -Wait' Return='check'/>
<InstallExecuteSequence>
<Custom Action='DownloadAndInvokeBootstrapper' Before='InstallFinalize'>
<![CDATA[NOT(REMOVE OR WVRTINSTALLED)]]>
</Custom>
</InstallExecuteSequence>

<!-- Embedded webview bootstrapper mode -->

<!-- Embedded offline installer -->




<InstallExecuteSequence>
<Custom Action="LaunchApplication" After="InstallFinalize">AUTOLAUNCHAPP AND NOT Installed</Custom>
</InstallExecuteSequence>

<SetProperty Id="ARPINSTALLLOCATION" Value="[INSTALLDIR]" After="CostFinalize"/>
</Product>
</Wix>