summaryrefslogtreecommitdiff
path: root/packaging/WiX/mysql_server.wxs.in
blob: 1802baedf3bfa6ba4fb182a56f8a8d9f074069c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" 
      xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">

<!--
   Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
   
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; version 2 of the License.
   
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-->

  <Product 
    Id="*" 
    UpgradeCode="49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3"
    Name="MySQL Server @MAJOR_VERSION@.@MINOR_VERSION@" 
    Version="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@" 
    Language="1033" 
    Manufacturer="@MANUFACTURER@">
    
    <Package Id='*'
       Keywords='Installer'
       Description="MySQL Database Server"
       Manufacturer='@MANUFACTURER@'
       InstallerVersion='200'
       Languages='1033'
       Compressed='yes'
       SummaryCodepage='1252'
       Platform='@Platform@'
       InstallScope="perMachine"/>
  
    <Media Id='1' Cabinet='product.cab' EmbedCab='yes' />

    <!-- Upgrade -->
    <Upgrade Id="49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3">
      <UpgradeVersion 
        Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.0"
        IncludeMinimum="yes"
        Maximum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@"
        IncludeMaximum="yes"
        Property="OLDERVERSIONBEINGUPGRADED"
        MigrateFeatures="yes"
        />
      <UpgradeVersion 
        Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@"
        IncludeMinimum="no"
        OnlyDetect="yes"
        Property="NEWERVERSIONDETECTED" />
    </Upgrade>
    <Condition Message="A later version of [ProductName] is already installed. Setup will now exit.">
      NOT NEWERVERSIONDETECTED OR Installed
    </Condition>
    <InstallExecuteSequence>
      <RemoveExistingProducts After="InstallInitialize"/>
    </InstallExecuteSequence>

    <!-- Save/restore install location -->
    <CustomAction Id="SaveTargetDir" Property="ARPINSTALLLOCATION" Value="[INSTALLDIR]" />
    <InstallExecuteSequence>
      <Custom Action="SaveTargetDir" After="InstallValidate">
        NOT
        Installed
      </Custom>
    </InstallExecuteSequence>
    <InstallUISequence>
      <!-- App search is what does FindInstallLocation, and it is dependent on FindRelatedProducts -->
      <AppSearch After="FindRelatedProducts"/>
    </InstallUISequence>
 
    <!-- Find previous installation -->
    <Property Id="INSTALLDIR">
      <RegistrySearch Id="FindInstallLocation"
          Root="HKLM"
          Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[OLDERVERSIONBEINGUPGRADED]"
          Name="InstallLocation"
          Type="raw" />
    </Property>
    <?if @Platform@ != "x64" ?>
        <Property Id="OLDERVERSION"> 
          <RegistrySearch Id="FindOlderVersion"
            Root="HKLM"
            Win64 = "no"
            Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[OLDERVERSIONBEINGUPGRADED]"
            Name="DisplayVersion"
            Type="raw" />
        </Property>
    <?else ?>
        <Property Id="OLDERVERSION"> 
          <RegistrySearch Id="FindOlderVersion"
            Root="HKLM"
            Win64 = "yes"
            Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[OLDERVERSIONBEINGUPGRADED]"
            Name="DisplayVersion"
            Type="raw" />
        </Property>
    <?endif ?>
    <Property Id="DATADIR">
      <RegistrySearch Id="FindDataDir"
          Root="HKLM"
          Key="SOFTWARE\MySQL AB\[ProductName]"
          Name="DataLocation"
          Type="raw" />
    </Property>
    <Property Id="INSTALLDIR2">
       <RegistrySearch Id="FindInstallLocation2"
          Root="HKLM"
          Key="SOFTWARE\MySQL AB\[ProductName]"
          Name="Location"
          Type="raw" />
    </Property>
    <CustomAction Id="SetInstallDir2" Property="INSTALLDIR" Value="[INSTALLDIR2]" /> 
    <InstallUISequence>
    <Custom Action="SetInstallDir2" After="AppSearch">INSTALLDIR2</Custom> 
    </InstallUISequence>


    <!-- UI -->
    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"></Property>
    <UIRef Id="@CPACK_WIX_UI@" />
    <UIRef Id="WixUI_ErrorProgressText" />
    <WixVariable
      Id="WixUIBannerBmp"
      Value="@CMAKE_CURRENT_SOURCE_DIR@/AdminHeader.jpg" />
    <WixVariable
      Id="WixUIDialogBmp"
      Value="@CMAKE_CURRENT_SOURCE_DIR@/AdminBackground.jpg" />
    <Icon
      Id="icon.ico"
      SourceFile="@CMAKE_CURRENT_SOURCE_DIR@/MySQLServer.ico"/>
    <Property
      Id="ARPPRODUCTICON"
      Value="icon.ico" />
    
    <!-- License -->
    <WixVariable
      Id="WixUILicenseRtf"
      Value="@COPYING_RTF@"/>

    <!-- How to remove the service on uninstall -->
    <Binary Id='wixca.dll' SourceFile='@WIXCA_LOCATION@' />
    <CustomAction Id="UnregisterProperty" Property="UnregisterService" Value="[INSTALLDIR]" Return="check" />
    <CustomAction Id="UnregisterPropertySilent" Property="UnregisterServiceSilently" Value="[INSTALLDIR]" Return="check" />
    <CustomAction Id="UnregisterService"
                  BinaryKey="wixca.dll"
                  DllEntry="RemoveService"
                  Execute="deferred"
                  Impersonate="no"
                  Return="check" />
    <CustomAction Id="UnregisterServiceSilently"
                  BinaryKey="wixca.dll"
                  DllEntry="RemoveServiceNoninteractive"
                  Execute="deferred"
                  Impersonate="no"
                  Return="check" />
    <InstallExecuteSequence>
      <Custom Action="UnregisterProperty" After="InstallInitialize">Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL"</Custom>
      <Custom Action="UnregisterPropertySilent" After="InstallInitialize">Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL"</Custom>
      <Custom Action="UnregisterService" After="UnregisterProperty">Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL" And UILevel&gt;4</Custom>
      <Custom Action="UnregisterServiceSilently" After="UnregisterPropertySilent">Installed And Not UPGRADINGPRODUCTCODE And REMOVE="ALL" And UILevel&lt;=4</Custom>
    </InstallExecuteSequence>

    <!-- Installation root-->
    <Directory Id='TARGETDIR' Name='SourceDir'>
      <Directory Id='@PlatformProgramFilesFolder@'>
        <Directory Id='directory.MySQL' Name='MySQL'>
          <Directory Id='INSTALLDIR' Name='MySQL Server @MAJOR_VERSION@.@MINOR_VERSION@'>
          </Directory>
        </Directory>
      </Directory>
    </Directory>
    
    <!-- CPACK_WIX_FEATURES -->
    @CPACK_WIX_FEATURES@
    
    <!-- CPACK_WIX_DIRECTORIES -->
    @CPACK_WIX_DIRECTORIES@
    
    <!--CPACK_WIX_COMPONENTS-->
    @CPACK_WIX_COMPONENTS@
    
    <!--CPACK_WIX_COMPONENTS_GROUPS -->
    @CPACK_WIX_COMPONENT_GROUPS@
    
    <!--CPACK_WIX_INCLUDES -->
    @CPACK_WIX_INCLUDES@
  </Product>

</Wix>