1<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
2      xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
3
4<!--
5   Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
6
7   This program is free software; you can redistribute it and/or modify
8   it under the terms of the GNU General Public License, version 2.0,
9   as published by the Free Software Foundation.
10
11   This program is also distributed with certain software (including
12   but not limited to OpenSSL) that is licensed under separate terms,
13   as designated in a particular file or component or in included license
14   documentation.  The authors of MySQL hereby grant you an additional
15   permission to link the program and your derivative works with the
16   separately licensed software that they have included with MySQL.
17
18   This program is distributed in the hope that it will be useful,
19   but WITHOUT ANY WARRANTY; without even the implied warranty of
20   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21   GNU General Public License, version 2.0, for more details.
22
23   You should have received a copy of the GNU General Public License
24   along with this program; if not, write to the Free Software
25   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26-->
27
28  <Product
29    Id="*"
30    UpgradeCode="@UPGRADE_CODE@"
31    Name="@PRODUCT_NAME@ @MAJOR_VERSION@.@MINOR_VERSION@"
32    Version="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@"
33    Language="1033"
34    Manufacturer="@MANUFACTURER@">
35
36    <Package Id='*'
37       Keywords='Installer'
38       Description="@PRODUCT_DESCRIPTION@"
39       Manufacturer='@MANUFACTURER@'
40       InstallerVersion='200'
41       Languages='1033'
42       Compressed='yes'
43       SummaryCodepage='1252'
44       Platform='@Platform@'
45       InstallScope="perMachine"/>
46
47    <Media Id='1' Cabinet='product.cab' EmbedCab='yes' />
48
49    <Property Id="MYSQL_INSTALLER" Secure="yes" />
50    <Property Id="MSIRESTARTMANAGERCONTROL" Value="Disable"/>
51
52    <!-- Upgrade -->
53    <Upgrade Id="@UPGRADE_ID@">
54      <?if '@PATCH_VERSION@' != '0'?>
55      <UpgradeVersion
56        Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.0"
57        IncludeMinimum="yes"
58        Maximum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@"
59        IncludeMaximum="yes"
60        Property="OLDERVERSIONBEINGUPGRADED"
61        MigrateFeatures="yes"
62        />
63      <?endif?>
64      <UpgradeVersion
65        Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@"
66        IncludeMinimum="no"
67        OnlyDetect="yes"
68        Property="NEWERVERSIONDETECTED" />
69    </Upgrade>
70    <Condition Message="A later version of [ProductName] is already installed. Setup will now exit.">
71      NOT NEWERVERSIONDETECTED OR Installed
72    </Condition>
73    <InstallExecuteSequence>
74      <RemoveExistingProducts After="InstallInitialize"/>
75    </InstallExecuteSequence>
76
77    <?if "@LINK_STATIC_RUNTIME_LIBRARIES@"="OFF" ?>
78      <?if "@Platform@"="x64"?>
79        <Property Id="VS12REDISTX64">
80          <RegistrySearch Id="FindRedistVS12"
81              Win64="no"
82              Root="HKLM"
83              Key="SOFTWARE\Microsoft\VisualStudio\12.0\VC\Runtimes\x64"
84              Name="Version"
85              Type="raw" />
86        </Property>
87        <Condition Message="This application requires Visual Studio 2013 x64 Redistributable. Please install the Redistributable then run this installer again.">
88          Installed OR VS12REDISTX64
89        </Condition>
90      <?elseif "@Platform@"="x86" ?>
91        <Property Id="VS12REDISTX86">
92          <RegistrySearch Id="FindRedistVS12"
93              Win64="no"
94              Root="HKLM"
95              Key="SOFTWARE\Microsoft\VisualStudio\12.0\VC\Runtimes\x86"
96              Name="Version"
97              Type="raw" />
98        </Property>
99        <Condition Message="This application requires Visual Studio 2013 x86 Redistributable. Please install the Redistributable then run this installer again.">
100          Installed OR VS12REDISTX86
101        </Condition>
102      <?endif?>
103    <?endif?>
104
105    <!-- Save/restore install location -->
106    <CustomAction Id="SaveTargetDir" Property="ARPINSTALLLOCATION" Value="[INSTALLDIR]" />
107    <InstallExecuteSequence>
108      <Custom Action="SaveTargetDir" After="InstallValidate">
109        NOT
110        Installed
111      </Custom>
112    </InstallExecuteSequence>
113    <InstallUISequence>
114      <!-- App search is what does FindInstallLocation, and it is dependent on FindRelatedProducts -->
115      <AppSearch After="FindRelatedProducts"/>
116    </InstallUISequence>
117
118    <!-- Find previous installation -->
119    <Property Id="GETINSTALLDIR">
120      <RegistrySearch Id="FindInstallLocation"
121          Root="HKLM"
122          @Win64@
123          Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[OLDERVERSIONBEINGUPGRADED]"
124          Name="InstallLocation"
125          Type="raw" />
126    </Property>
127    <CustomAction Id="SetInstall"    Property="INSTALLDIR" Value="[GETINSTALLDIR]" />
128    <InstallUISequence>
129       <Custom Action="SetInstall"    After="AppSearch">Installed</Custom>
130    </InstallUISequence>
131    <Property Id="OLDERVERSION">
132      <RegistrySearch Id="FindOlderVersion"
133        Root="HKLM"
134        @Win64@
135        Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[OLDERVERSIONBEINGUPGRADED]"
136        Name="DisplayVersion"
137        Type="raw" />
138    </Property>
139    <Property Id="INSTALLDIR2">
140       <RegistrySearch Id="FindInstallLocation2"
141          Root="HKLM"
142          Key="SOFTWARE\MySQL AB\[ProductName]"
143          Name="Location"
144          Type="raw" />
145    </Property>
146    <CustomAction Id="SetInstallDir2" Property="INSTALLDIR" Value="[INSTALLDIR2]" />
147    <InstallUISequence>
148    <Custom Action="SetInstallDir2" After="AppSearch">INSTALLDIR2</Custom>
149    </InstallUISequence>
150
151    <CustomAction Id="QtRemoveService" BinaryKey="WixCA" DllEntry="WixQuietExec"
152            Execute="deferred" Return="ignore" Impersonate="no"/>
153    <InstallExecuteSequence>
154      <Custom Action="QtRemoveService" After="InstallInitialize">(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL") AND (NOT MYSQL_INSTALLER="YES")</Custom>
155    </InstallExecuteSequence>
156    <SetProperty Before="QtRemoveService" Sequence="execute" Id="QtRemoveService" Value="&quot;cmd.exe&quot; /S /V:ON /C &quot;echo off&amp;set &quot;d=[INSTALLDIR]&quot;&amp;FOR /f &quot;skip=1&quot; %s in (&apos;wmic service where ^&apos;pathname like &quot;%!d:\=\\!%&quot;^&apos; get name ^| findstr /r &quot;^.$&quot;&apos;) do ((for /L %k IN (1,1,20) do wmic service where &apos;name=&quot;%s&quot; and started=&quot;true&quot;&apos; call stopservice | FIND /v &quot;No Instance&quot;>NUL&amp;&amp;timeout /t 5 /nobreak>NUL)&amp;sc delete %s>NUL)&quot;"/>
157
158
159    <!-- UI -->
160    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"></Property>
161    <UIRef Id="@CPACK_WIX_UI@" />
162    <UIRef Id="WixUI_ErrorProgressText" />
163    <WixVariable
164      Id="WixUIBannerBmp"
165      Value="@CMAKE_CURRENT_SOURCE_DIR@/AdminHeader.jpg" />
166    <WixVariable
167      Id="WixUIDialogBmp"
168      Value="@CMAKE_CURRENT_SOURCE_DIR@/AdminBackground.jpg" />
169    <Icon
170      Id="icon.ico"
171      SourceFile="@CMAKE_CURRENT_SOURCE_DIR@/MySQLServer.ico"/>
172    <Icon
173      Id="Icon.MysqlCmdShell"
174      SourceFile='@CMAKE_CURRENT_SOURCE_DIR@/mysqlcommandlineshell.ico' />
175    <Property
176      Id="ARPPRODUCTICON"
177      Value="icon.ico" />
178
179    <!-- License -->
180    <WixVariable
181      Id="WixUILicenseRtf"
182      Value="@LICENSE_RTF@"/>
183
184    <!-- Installation root-->
185    <Directory Id='TARGETDIR' Name='SourceDir'>
186      <Directory Id='@PlatformProgramFilesFolder@'>
187        <Directory Id='directory.MySQL' Name='MySQL'>
188          <Directory Id='INSTALLDIR' Name='@PRODUCT_NAME@ @MAJOR_VERSION@.@MINOR_VERSION@'>
189          </Directory>
190        </Directory>
191      </Directory>
192    </Directory>
193
194    <!-- CPACK_WIX_FEATURES -->
195    @CPACK_WIX_FEATURES@
196
197    <!-- CPACK_WIX_DIRECTORIES -->
198    @CPACK_WIX_DIRECTORIES@
199
200    <!--CPACK_WIX_COMPONENTS-->
201    @CPACK_WIX_COMPONENTS@
202
203    <!--CPACK_WIX_COMPONENTS_GROUPS -->
204    @CPACK_WIX_COMPONENT_GROUPS@
205
206    <!--CPACK_WIX_INCLUDES -->
207    @CPACK_WIX_INCLUDES@
208  </Product>
209
210</Wix>
211