Debian Codegraph @

bypy/windows/wix-template.xml

raw
1 <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util" xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
2
3 <Package Name="{app}{x64}" UpgradeCode="{upgrade_code}" Language="1033" Codepage="1252" Version="{version}" Manufacturer="Kovid Goyal" InstallerVersion="300" Scope="perMachine">
4
5 <SummaryInformation Keywords="Installer" Description="{app} Installer" Manufacturer="Kovid Goyal" />
6
7 <!-- Disable creation of system restore points on calibre installs. Speeds
8 up the install. We don't need system restore since we don't install any
9 system DLLs/components anyway (apart from start menu entries) -->
10 <Property Id="MSIFASTINSTALL" Value="3" />
11
12 <Media Id="1" Cabinet="{app}.cab" CompressionLevel="{compression}" EmbedCab="yes" />
13 <!-- The following line ensures that DLLs are replaced even if
14 their version is the same as before or they don't have versions.
15 Microsoft's brain dead installer will otherwise use file dates to
16 determine whether to install a file or not. Simply not robust. And
17 since we don't install any system files whatsoever, we can never replace
18 a system file with an older version. This way the calibre install
19 should always result in a consistent set of files being present in the
20 installation folder, though of course, with Microsoft there are no
21 guarantees of anything. -->
22 <Property Id="REINSTALLMODE" Value="amus" />
23
24 <!-- get the windows build number -->
25 <Property Id="WINDOWSBUILDNUMBER" Secure="yes">
26 <RegistrySearch Id="BuildNumberSearch" Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion" Name="CurrentBuildNumber" Type="raw" />
27 </Property>
28
29 <Upgrade Id="{upgrade_code}">
30 <UpgradeVersion Maximum="{version}" IncludeMaximum="yes" OnlyDetect="no" Language="1033" MigrateFeatures="yes" Property="OLDPRODUCTFOUND" />
31 <UpgradeVersion Minimum="{version}" IncludeMinimum="no" OnlyDetect="yes" Language="1033" Property="NEWPRODUCTFOUND" />
32 </Upgrade>
33 <Upgrade Id="BEB2A80D-E902-4DAD-ADF9-8BD2DA42CFE1">
34 <UpgradeVersion Maximum="{version}" IncludeMaximum="yes" OnlyDetect="no" Language="1033" MigrateFeatures="yes" Property="THIRTYTWOBITINSTALLFOUND" />
35 </Upgrade>
36 <CustomAction Id="PreventDowngrading" Error="Newer version of {app} already installed. If you want to downgrade you must uninstall {app} first." />
37
38 <Property Id="APPLICATIONFOLDER">
39 <RegistrySearch Id="calibreInstDir" Type="raw" Root="HKLM" Key="Software\{app}{x64}\Installer" Name="InstallPath" />
40 </Property>
41
42 <util:CloseApplication Id="CheckRunningCalibre" Target="calibre.exe" PromptToContinue="yes" RebootPrompt="no"
43 Description="calibre is currently running, close it first and then click Retry. If you click Ignore, you will have to reboot after installation."
44 />
45 <util:CloseApplication Id="CheckRunningViewer" Target="ebook-viewer.exe" PromptToContinue="yes" RebootPrompt="no"
46 Description="The calibre viewer is currently running, close it first and then click Retry. If you click Ignore, you will have to reboot after installation."
47 />
48 <util:CloseApplication Id="CheckRunningEditor" Target="ebook-edit.exe" PromptToContinue="yes" RebootPrompt="no"
49 Description="The calibre editor is currently running, close it first and then click Retry. If you click Ignore, you will have to reboot after installation."
50 />
51 <util:CloseApplication Id="CheckRunningCalibreP" Target="calibre-parallel.exe" PromptToContinue="yes" RebootPrompt="no"
52 Description="calibre or one of its components is currently running, close it first and then click Retry. If you click Ignore, you will have to reboot after installation. You may need to open Task Manager and kill any calibre processes you see."
53 />
54
55 <Icon Id="main_icon" SourceFile="{main_icon}" />
56 <!-- <Icon Id="viewer_icon" SourceFile="{viewer_icon}"/> -->
57 <!-- <Icon Id="editor_icon" SourceFile="{editor_icon}"/> -->
58
59 <StandardDirectory Id="ProgramFiles64Folder">
60 <Directory Id="APPLICATIONFOLDER" Name="Calibre2" />
61 </StandardDirectory>
62 <StandardDirectory Id="ProgramMenuFolder">
63 <Directory Id="ApplicationProgramsFolder" Name="{app}{x64} - E-book Management" />
64 </StandardDirectory>
65 <StandardDirectory Id="DesktopFolder" />
66
67 <DirectoryRef Id="APPLICATIONFOLDER">
68 {app_components}
69 <Component Id="AddToPath">
70 <Environment Id="UpdatePath" Name="PATH" Action="set" System="yes" Part="last" Value="[APPLICATIONFOLDER]" />
71 <RegistryValue Root="HKCU" Key="Software\Microsoft\{app}{x64}" Name="system_path_updated" Type="integer" Value="1" KeyPath="yes" />
72 </Component>
73 <Component Id="RememberInstallDir">
74 <RegistryValue Root="HKLM" Key="Software\{app}{x64}\Installer" Name="InstallPath" Type="string" Value="[APPLICATIONFOLDER]" KeyPath="yes" />
75 </Component>
76 <Component Id="calibreProtocol">
77 <RegistryKey Root="HKCR" Key="calibre" ForceDeleteOnUninstall="yes">
78 <RegistryValue Type="string" Value="URL:calibre Protocol" KeyPath="yes" />
79 <RegistryValue Type="string" Name="URL Protocol" Value="" />
80 <RegistryKey Key="DefaultIcon">
81 <RegistryValue Type="string" Value="[APPLICATIONFOLDER]calibre.exe" />
82 </RegistryKey>
83 <RegistryKey Key="shell\open\command">
84 <RegistryValue Type="string" Value="&quot;[APPLICATIONFOLDER]calibre.exe&quot; &quot;%1&quot;" />
85 </RegistryKey>
86 </RegistryKey>
87 </Component>
88 </DirectoryRef>
89
90 <DirectoryRef Id="ApplicationProgramsFolder">
91 <Component Id="StartMenuShortcuts">
92 <Shortcut Id="s1" Name="{app}{x64} - E-book management" Description="Manage your e-book collection, read or edit your e-books and download news" Target="[#{exe_map[calibre]}]" WorkingDirectory="APPLICATIONFOLDER">
93 <ShortcutProperty Key="System.AppUserModel.ID" Value="{main_app_uid}"/>
94 </Shortcut>
95 <Shortcut Id="s2" Name="E-book viewer{x64}" Description="Viewer for all the major e-book formats" Target="[#{exe_map[ebook-viewer]}]" WorkingDirectory="APPLICATIONFOLDER">
96 <ShortcutProperty Key="System.AppUserModel.ID" Value="{viewer_app_uid}"/>
97 </Shortcut>
98 <Shortcut Id="s4" Name="Edit E-book{x64}" Description="Edit e-books" Target="[#{exe_map[ebook-edit]}]" WorkingDirectory="APPLICATIONFOLDER">
99 <ShortcutProperty Key="System.AppUserModel.ID" Value="{editor_app_uid}"/>
100 </Shortcut>
101 <Shortcut Id="s3" Name="LRF viewer{x64}" Description="Viewer for LRF format e-books" Target="[#{exe_map[lrfviewer]}]" WorkingDirectory="APPLICATIONFOLDER" />
102 <util:InternetShortcut Id="OnlineDocumentationShortcut" Name="User Manual" Type="url" Target="https://manual.calibre-ebook.com" />
103 <util:InternetShortcut Id="GetInvolvedS" Name="Get Involved" Type="url" Target="https://calibre-ebook.com/get-involved" />
104
105 <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall" />
106 <RegistryValue Root="HKCU" Key="Software\Microsoft\{app}{x64}" Name="start_menu_shortcuts_installed" Type="integer" Value="1" KeyPath="yes" />
107 </Component>
108 </DirectoryRef>
109
110 <StandardDirectory Id="DesktopFolder">
111 <Component Id="DesktopShortcut">
112 <Shortcut Id="ds1" Name="{app}{x64} - E-book management" Description="Manage your e-book collection, read or edit your e-books and download news" Target="[#{exe_map[calibre]}]" WorkingDirectory="APPLICATIONFOLDER" />
113 <RegistryValue Root="HKCU" Key="Software\Microsoft\{app}{x64}" Name="desktop_shortcut_installed" Type="integer" Value="1" KeyPath="yes" />
114 </Component>
115 </StandardDirectory>
116
117
118 <Feature Id="Complete" Title="{app}" Display="expand" Level="1" ConfigurableDirectory="APPLICATIONFOLDER">
119
120 <Feature Id="MainApplication" Title="Program Files" Level="1" Description="All the files needed to run {app}" AllowAbsent="no">
121 <ComponentRef Id="RememberInstallDir" />
122 </Feature>
123
124 <Feature Id="FSMS" Title="Start menu shortcuts" Level="1" Description="Program shortcuts installed in the Start Menu">
125 <ComponentRef Id="StartMenuShortcuts" />
126 </Feature>
127
128 <Feature Id="DS" Title="Shortcut on desktop" Level="1" Description="Shortcut to {app} on your desktop">
129 <ComponentRef Id="DesktopShortcut" />
130 </Feature>
131
132 <Feature Id="FAddToPath" Title="Add install directory to path" Level="1" Description="Add installation directory to PATH. Makes using command line tools easier">
133 <ComponentRef Id="AddToPath" />
134 </Feature>
135
136 <Feature Id="FcalibreProtocol" Title="Register calibre:// URLs" Level="1" Description="Register to handle URLs starting with calibre://">
137 <ComponentRef Id="calibreProtocol" />
138 </Feature>
139 </Feature>
140
141 <!-- Add icon to entry in Add/Remove programs -->
142 <Property Id="ARPPRODUCTICON" Value="main_icon" />
143 <Property Id="ARPURLINFOABOUT" Value="https://calibre-ebook.com" />
144 <Property Id="ARPHELPLINK" Value="https://calibre-ebook.com/help" />
145 <Property Id="ARPURLUPDATEINFO" Value="https://calibre-ebook.com/download_windows" />
146 <SetProperty Id="ARPINSTALLLOCATION" Value="[APPLICATIONFOLDER]" After="CostFinalize" />
147
148 <!-- See https://en.wikipedia.org/wiki/Windows_10_version_history for build numbers -->
149
150 <Launch Condition="Installed OR (WINDOWSBUILDNUMBER &gt;= 10240)" Message="calibre requires Windows 10 or newer." />
151
152 <!-- On 64 bit installers there is a bug in WiX that causes the
153 WixSetDefaultPerMachineFolder action to incorrectly set
154 APPLICATIONFOLDER to the x86 value, so we override it. See
155 http://stackoverflow.com/questions/5479790/wix-how-to-override-c-program-files-x86-on-x64-machine-in-wixui-advanced-s
156 -->
157 <CustomAction Id="OverwriteWixSetDefaultPerMachineFolder" Property="WixPerMachineFolder" Value="[APPLICATIONFOLDER]" Execute="immediate" />
158
159 <InstallExecuteSequence>
160 <Custom Action="PreventDowngrading" After="FindRelatedProducts" Condition="NEWPRODUCTFOUND" />
161 <Custom Action="OverwriteWixSetDefaultPerMachineFolder" After="WixSetDefaultPerMachineFolder" />
162 <RemoveExistingProducts After="InstallFinalize" />
163 </InstallExecuteSequence>
164 <InstallUISequence>
165 <Custom Action="PreventDowngrading" After="FindRelatedProducts" Condition="NEWPRODUCTFOUND" />
166 <Custom Action="OverwriteWixSetDefaultPerMachineFolder" After="WixSetDefaultPerMachineFolder" />
167 </InstallUISequence>
168
169 <UI>
170 <ui:WixUI Id="WixUI_Advanced" />
171 <UIRef Id="WixUI_ErrorProgressText" />
172 <Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication" Condition="WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed" />
173
174 </UI>
175
176 <!--
177 Set default folder name. For a per-machine installation, the default
178 installation location will be [ProgramFilesFolder][ApplicationFolderName]
179 and the user will be able to change it in the setup UI.
180 -->
181 <Property Id="ApplicationFolderName" Value="Calibre2" />
182 <Property Id="WixAppFolder" Value="WixPerMachineFolder" />
183 <WixVariable Id="WixUISupportPerUser" Value="0" />
184
185 <!-- Add option to launch calibre after install -->
186 <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch {app}" />
187 <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1" />
188 <Property Id="WixShellExecTarget" Value="[#{exe_map[calibre]}]" />
189 <CustomAction Id="LaunchApplication" DllEntry="WixShellExec" Impersonate="yes" BinaryRef="Wix4UtilCA_X86" />
190
191 <!-- UI -->
192 <WixVariable Id="WixUILicenseRtf" Value="{license}" />
193 <WixVariable Id="WixUIBannerBmp" Value="{banner}" />
194 <WixVariable Id="WixUIDialogBmp" Value="{dialog}" />
195
196 </Package>
197 </Wix>