JMP.wxs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
  3. xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
  4. <?include Global.wxi ?>
  5. <?include Version.wxi ?>
  6. <!-- https://stackoverflow.com/questions/4658220/create-shortcut-checkbox -->
  7. <!-- https://stackoverflow.com/questions/11868499/create-shortcut-to-desktop-using-wix -->
  8. <!-- https://michielsioen.be/2017-12-02-wix-bootstrapper-customization/ -->
  9. <?define FirstProductVersion=0.0.0 ?>
  10. <?define JellyfinMediaPlayerRegistryKey=Software\Jellyfin\Jellyfin Media Player?>
  11. <!-- To keep things simple, the installer considers each new release
  12. a major upgrade, in which everything is uninstalled, then reinstalled
  13. To accomplish this, we change the Product Id on every build.
  14. However, the upgrade code remains the same on every build, to ensure
  15. that newer installers recognize older installations -->
  16. <Product Id="*" Name="$(var.ProductName)" Language="1033" Version="$(var.Version)" Manufacturer="Jellyfin" UpgradeCode="$(var.ProductUUID)">
  17. <!-- Package Ids change on every build, by definition -->
  18. <Package Id="*" Platform="x64" InstallerVersion="405" Compressed="yes" Description="$(var.ProductDesc)" InstallScope="perMachine" />
  19. <!-- allow for reinstall, this is needed to force installation when the version match -->
  20. <Property Id="REINSTALLMODE" Value="amus"/>
  21. <!-- Embedded, compressed cab file -->
  22. <Media Id="1" Cabinet="pmp.cab" EmbedCab="yes" CompressionLevel="high" />
  23. <!-- We support Windows 7 and above -->
  24. <Condition Message="$(var.OldWindowsError)">
  25. <![CDATA[VersionNT >= 601]]>
  26. </Condition>
  27. <!-- Icon used in the control panel -->
  28. <Icon Id="JellyfinMediaPlayerIcon" SourceFile="jellyfin.ico" />
  29. <!-- Useful control panel fields -->
  30. <?include ControlPanel.wxi ?>
  31. <!-- Upgrade and downgrade handling -->
  32. <Upgrade Id="$(var.ProductUUID)">
  33. <!-- Detect newer versions -->
  34. <UpgradeVersion Minimum="$(var.Version)"
  35. IncludeMinimum="no"
  36. OnlyDetect="yes"
  37. Property="NEWERPRODUCTFOUND" />
  38. <!-- Detect older versions -->
  39. <UpgradeVersion Minimum="$(var.FirstProductVersion)"
  40. Maximum="$(var.Version)"
  41. IncludeMinimum="yes"
  42. IncludeMaximum="no"
  43. Property="PREVIOUSVERSIONINSTALLED" />
  44. </Upgrade>
  45. <!-- Running program termination -->
  46. <util:CloseApplication Id="JellyfinMediaPlayer" CloseMessage="yes" Target="JellyfinMediaPlayer.exe" ElevatedCloseMessage="yes" RebootPrompt="yes" />
  47. <!-- Custom action to Install MediaFoundation on Windows Server -->
  48. <Property Id="WINDOWSTYPE" Value="Client"/>
  49. <Property Id="WixQuietExec64CmdLine" Value='"C:\Windows\System32\dism.exe" /online /enable-feature /all /featurename:ServerMediaFoundation /NoRestart'/>
  50. <CustomAction Id="EnableMediaFoundation" BinaryKey="WixCA" DllEntry="WixQuietExec64" Execute="immediate" Return="ignore" Impersonate="no"/>
  51. <Property Id="AUTOLAUNCH" Value="0"/>
  52. <Property Id="WixShellExecTarget" Value="[INSTALLLOCATION]JellyfinMediaPlayer.exe" />
  53. <CustomAction Id="LaunchPMP" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" Return="ignore"/>
  54. <InstallExecuteSequence>
  55. <!-- Prevent downgrades from newer versions -->
  56. <Custom Action="PreventDowngrades" After="FindRelatedProducts">NEWERPRODUCTFOUND</Custom>
  57. <!-- Uninstall older versions before installing ourselves -->
  58. <RemoveShortcuts>Installed AND NOT UPGRADINGPRODUCTCODE</RemoveShortcuts>
  59. <RemoveExistingProducts After="InstallInitialize">PREVIOUSVERSIONINSTALLED</RemoveExistingProducts>
  60. <Custom Action="LaunchPMP" After="InstallFinalize"><![CDATA[AUTOLAUNCH = 1]]></Custom>
  61. <Custom Action="WixCloseApplications" After="InstallInitialize" />
  62. <Custom Action="EnableMediaFoundation" Before="CostFinalize">WINDOWSTYPE~="Server"</Custom>
  63. </InstallExecuteSequence>
  64. <!-- Custom Actions -->
  65. <CustomAction Id="PreventDowngrades" Error="$(var.NewerVersionError)" />
  66. <!-- The default installation directory is under [ProgramFilesFolder] -->
  67. <Directory Id="TARGETDIR" Name="SourceDir">
  68. <Directory Id="ProgramFiles64Folder">
  69. <Directory Id="INSTALLLOCATION" Name="Msi">
  70. </Directory>
  71. </Directory>
  72. <Directory Id="ProgramMenuFolder">
  73. <Directory Id="JellyfinStartMenuFolder" Name="Jellyfin Media Player"/>
  74. </Directory>
  75. <Directory Id="DesktopFolder" Name="Desktop">
  76. <Component Id="ApplicationShortcutDesktop" Guid="{b2a1316d-917f-433f-bd87-02ec717c2648}">
  77. <Condition>ADDDESKTOPSHORTCUT=1</Condition>
  78. <Shortcut Id="ApplicationDesktopShortcut"
  79. Name="Jellyfin Media Player"
  80. Description="Desktop client for Jellyfin"
  81. Target="[INSTALLLOCATION]JellyfinMediaPlayer.exe"
  82. WorkingDirectory="INSTALLLOCATION"/>
  83. <RemoveFolder Id="DesktopFolder" On="uninstall"/>
  84. <RegistryValue
  85. Root="HKCU"
  86. Key="Software\Jellyfin\Jellyfin Media Player"
  87. Name="installed"
  88. Type="integer"
  89. Value="1"
  90. KeyPath="yes"/>
  91. </Component>
  92. </Directory>
  93. </Directory>
  94. <!-- Start Menu shortcut -->
  95. <DirectoryRef Id="JellyfinStartMenuFolder">
  96. <Component Id="JellyfinMediaPlayerShortcuts" Guid="*">
  97. <Shortcut Id="JellyfinMediaPlayerExeShortcut"
  98. Name="Jellyfin Media Player"
  99. Description="Jellyfin Media Player for Windows"
  100. Target="[INSTALLLOCATION]JellyfinMediaPlayer.exe"
  101. WorkingDirectory="INSTALLLOCATION" />
  102. <RegistryKey Root="HKCU" Key="Software\Jellyfin\Jellyfin Media Player">
  103. <RegistryValue Name="InstallFolder" Type="string" Value="[INSTALLLOCATION]" Action="write" KeyPath="no" />
  104. </RegistryKey>
  105. <RemoveFolder Id="JellyfinStartMenuFolder" On="uninstall" />
  106. </Component>
  107. </DirectoryRef>
  108. <!-- Product Feature -->
  109. <Feature Id="ProductFeature" Title="Jellyfin" Level="1">
  110. <ComponentGroupRef Id="ProgramFilesComponentGroup" />
  111. <ComponentRef Id="JellyfinMediaPlayerShortcuts" />
  112. <ComponentRef Id="ApplicationShortcutDesktop" />
  113. </Feature>
  114. </Product>
  115. </Wix>