JMP.wxs 5.3 KB

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