Commit 2b588155 authored by Daniel Fischer's avatar Daniel Fischer

Changes to MSI installer:

- Introduce MANUFACTURER setting to set package manufacturer via CMake.
- Introduce COMMUNITY_BUILD setting to be passed on to packaging
  (not used here, but required for our own packages to determine what
   added files should be included in the package).
- Create an RTF version of the COPYING text file and use that as the
  default license (can be overridden by providing a COPYING.rtf file).
- Allow passing extra arguments to candle and light via environment.
  (Need -sval in pushbuild, but want validation elsewhere.)
- Introduce a custom action that stops and uninstalls the service 
  if the user installed one that points into the MySQL directory
  that is being removed.
  (Our own packages historically used the instance configuration wizard
  for this, but it wouldn't be very nice if MSIs created by our users
  couldn't remove it too.)
- Make install location configurable again ("Browse" button in custom
  installation was greyed out before).
- Remove registry keys that use "MySQL AB"; they should only be set in 
  packages provided by us. Users can set their own registry keys if
  they want to.
parent 33b57ce2
...@@ -36,6 +36,18 @@ SET(CUSTOM_C_FLAGS $ENV{CFLAGS}) ...@@ -36,6 +36,18 @@ SET(CUSTOM_C_FLAGS $ENV{CFLAGS})
OPTION(WITH_DEBUG "Use dbug/safemutex" OFF) OPTION(WITH_DEBUG "Use dbug/safemutex" OFF)
OPTION(WITH_DEBUG_FULL "Use dbug and safemalloc/safemutex. Slow" OFF) OPTION(WITH_DEBUG_FULL "Use dbug and safemalloc/safemutex. Slow" OFF)
# Distinguish between community and non-community builds, with the
# default being a community build. This does not impact the feature
# set that will be compiled in; it's merely provided as a hint to
# custom packaging steps.
OPTION(COMMUNITY_BUILD "Set to true if this is a community build" ON)
# Use a default manufacturer if no manufacturer was identified.
SET(MANUFACTURER_DOCSTRING
"Set the entity that appears as the manufacturer of packages that support a manufacturer field.")
IF(NOT DEFINED MANUFACTURER)
SET(MANUFACTURER "Built from Source" CACHE BOOL ${MANUFACTURER_DOCSTRING})
ENDIF()
# We choose to provide WITH_DEBUG as alias to standard CMAKE_BUILD_TYPE=Debug # We choose to provide WITH_DEBUG as alias to standard CMAKE_BUILD_TYPE=Debug
# which turns out to be not trivial, as this involves synchronization # which turns out to be not trivial, as this involves synchronization
......
# Copyright 2010, Oracle and/or its affiliates. All rights reserved.
IF(NOT WIN32) #
RETURN() # This program is free software; you can redistribute it and/or modify
ENDIF() # it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
FIND_PATH(WIX_DIR heat.exe #
$ENV{WIX_DIR}/bin # This program is distributed in the hope that it will be useful,
$ENV{ProgramFiles}/wix/bin # but WITHOUT ANY WARRANTY; without even the implied warranty of
"$ENV{ProgramFiles}/Windows Installer XML v3/bin" # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
"$ENV{ProgramFiles}/Windows Installer XML v3.5/bin" # GNU General Public License for more details.
) #
# You should have received a copy of the GNU General Public License
IF(NOT WIX_DIR) # along with this program; if not, write to the Free Software
IF(NOT _WIX_DIR_CHECKED) # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
SET(_WIX_DIR_CHECKED 1 CACHE INTERNAL "")
MESSAGE(STATUS "Cannot find wix 3, installer project will not be generated") IF(NOT WIN32)
ENDIF() RETURN()
RETURN() ENDIF()
ENDIF()
FIND_PATH(WIX_DIR heat.exe
# extra.wxs.in needs DATADIR_MYSQL_FILES and DATADIR_PERFORMANCE_SCHEMA_FILES, i.e $ENV{WIX_DIR}/bin
# Wix-compatible file lists for ${builddir}\sql\data\{mysql,performance_schema} $ENV{ProgramFiles}/wix/bin
"$ENV{ProgramFiles}/Windows Installer XML v3/bin"
FOREACH(dir mysql performance_schema) "$ENV{ProgramFiles}/Windows Installer XML v3.5/bin"
FILE(GLOB files ${CMAKE_BINARY_DIR}/sql/data/${dir}/*) )
SET(filelist)
FOREACH(f ${files}) IF(NOT WIX_DIR)
FILE(TO_NATIVE_PATH "${f}" file_native_path) IF(NOT _WIX_DIR_CHECKED)
GET_FILENAME_COMPONENT(file_name "${f}" NAME) SET(_WIX_DIR_CHECKED 1 CACHE INTERNAL "")
SET(filelist MESSAGE(STATUS "Cannot find wix 3, installer project will not be generated")
"${filelist} ENDIF()
<File Id='${file_name}' Source='${file_native_path}'/>") RETURN()
ENDFOREACH() ENDIF()
STRING(TOUPPER ${dir} DIR_UPPER)
SET(DATADIR_${DIR_UPPER}_FILES "${filelist}") ADD_SUBDIRECTORY(ca)
ENDFOREACH()
# extra.wxs.in needs DATADIR_MYSQL_FILES and DATADIR_PERFORMANCE_SCHEMA_FILES, i.e
# Wix-compatible file lists for ${builddir}\sql\data\{mysql,performance_schema}
FIND_PROGRAM(HEAT_EXECUTABLE heat ${WIX_DIR})
FIND_PROGRAM(CANDLE_EXECUTABLE candle ${WIX_DIR}) FOREACH(dir mysql performance_schema)
FIND_PROGRAM(LIGHT_EXECUTABLE light ${WIX_DIR}) FILE(GLOB files ${CMAKE_BINARY_DIR}/sql/data/${dir}/*)
SET(filelist)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/create_msi.cmake.in FOREACH(f ${files})
${CMAKE_CURRENT_BINARY_DIR}/create_msi.cmake FILE(TO_NATIVE_PATH "${f}" file_native_path)
@ONLY) GET_FILENAME_COMPONENT(file_name "${f}" NAME)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/extra.wxs.in SET(filelist
${CMAKE_CURRENT_BINARY_DIR}/extra.wxs "${filelist}
@ONLY <File Id='${file_name}' Source='${file_native_path}'/>")
) ENDFOREACH()
STRING(TOUPPER ${dir} DIR_UPPER)
IF(CMAKE_GENERATOR MATCHES "Visual Studio") SET(DATADIR_${DIR_UPPER}_FILES "${filelist}")
SET(CONFIG_PARAM "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_CFG_INTDIR}") ENDFOREACH()
ENDIF()
FIND_PROGRAM(HEAT_EXECUTABLE heat ${WIX_DIR})
ADD_CUSTOM_TARGET( FIND_PROGRAM(CANDLE_EXECUTABLE candle ${WIX_DIR})
MSI FIND_PROGRAM(LIGHT_EXECUTABLE light ${WIX_DIR})
COMMAND set VS_UNICODE_OUTPUT=
COMMAND ${CMAKE_COMMAND} CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/create_msi.cmake.in
-DCPACK_WIX_CONFIG=${CMAKE_CURRENT_SOURCE_DIR}/CPackWixConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/create_msi.cmake
-DCPACK_WIX_INCLUDE=${CMAKE_CURRENT_BINARY_DIR}/extra.wxs @ONLY)
${CONFIG_PARAM}
-P ${CMAKE_CURRENT_BINARY_DIR}/create_msi.cmake IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
) SET(WixWin64 " Win64='yes'")
ELSE()
ADD_CUSTOM_TARGET( SET(WixWin64)
MSI_ESSENTIALS ENDIF()
COMMAND set VS_UNICODE_OUTPUT= CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/extra.wxs.in
COMMAND ${CMAKE_COMMAND} -DESSENTIALS=1 ${CMAKE_CURRENT_BINARY_DIR}/extra.wxs)
-DCPACK_WIX_CONFIG=${CMAKE_CURRENT_SOURCE_DIR}/CPackWixConfig.cmake
-DCPACK_WIX_INCLUDE=${CMAKE_CURRENT_BINARY_DIR}/extra.wxs IF(CMAKE_GENERATOR MATCHES "Visual Studio")
${CONFIG_PARAM} SET(CONFIG_PARAM "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_CFG_INTDIR}")
-P ${CMAKE_CURRENT_BINARY_DIR}/create_msi.cmake ENDIF()
)
# WiX wants the license text as rtf; if there is no rtf license,
# we create a fake one from the plain text COPYING file.
IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.rtf")
MESSAGE("copying COPYING.rtf")
FILE(READ "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.rtf" CONTENTS)
FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/COPYING.rtf" "${CONTENTS}")
ELSE()
MESSAGE("creating COPYING.rtf")
FILE(READ "${CMAKE_CURRENT_SOURCE_DIR}/../../COPYING" CONTENTS)
STRING(REGEX REPLACE "\n" "\\\\par\n" CONTENTS "${CONTENTS}")
STRING(REGEX REPLACE "\t" "\\\\tab" CONTENTS "${CONTENTS}")
FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/COPYING.rtf" "{\\rtf1\\ansi\\deff0{\\fonttbl{\\f0\\fnil\\fcharset0 Courier New;}}\\viewkind4\\uc1\\pard\\lang1031\\f0\\fs15")
FILE(APPEND "${CMAKE_CURRENT_BINARY_DIR}/COPYING.rtf" "${CONTENTS}")
FILE(APPEND "${CMAKE_CURRENT_BINARY_DIR}/COPYING.rtf" "\n}\n")
ENDIF()
ADD_CUSTOM_TARGET(
MSI
COMMAND set VS_UNICODE_OUTPUT=
COMMAND ${CMAKE_COMMAND}
-DCPACK_WIX_CONFIG=${CMAKE_CURRENT_SOURCE_DIR}/CPackWixConfig.cmake
-DCPACK_WIX_INCLUDE=${CMAKE_CURRENT_BINARY_DIR}/extra.wxs
${CONFIG_PARAM}
-P ${CMAKE_CURRENT_BINARY_DIR}/create_msi.cmake
)
ADD_DEPENDENCIES(MSI wixca)
ADD_CUSTOM_TARGET(
MSI_ESSENTIALS
COMMAND set VS_UNICODE_OUTPUT=
COMMAND ${CMAKE_COMMAND} -DESSENTIALS=1
-DCPACK_WIX_CONFIG=${CMAKE_CURRENT_SOURCE_DIR}/CPackWixConfig.cmake
-DCPACK_WIX_INCLUDE=${CMAKE_CURRENT_BINARY_DIR}/extra.wxs
${CONFIG_PARAM}
-P ${CMAKE_CURRENT_BINARY_DIR}/create_msi.cmake
)
ADD_DEPENDENCIES(MSI wixca)
# Copyright 2010, 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
INCLUDE_DIRECTORIES(${WIX_DIR}/../SDK/inc)
LINK_DIRECTORIES(${WIX_DIR}/../SDK/lib)
SET(WIXCA_SOURCES CustomAction.cpp CustomAction.rc CustomAction.def)
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
LINK_LIBRARIES(wcautil_x64 dutil_x64 msi version)
ELSE()
LINK_LIBRARIES(wcautil dutil msi version)
ENDIF()
ADD_LIBRARY(wixca SHARED ${WIXCA_SOURCES})
/* Copyright 2010, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef UNICODE
#define UNICODE
#endif
#include <windows.h>
#include <winreg.h>
#include <msi.h>
#include <msiquery.h>
#include <wcautil.h>
#include <string.h>
#include <strsafe.h>
/*
* Search the registry for a service whose ImagePath starts
* with our install directory. Stop and remove it if requested.
*/
static TCHAR last_service_name[128];
int remove_service(TCHAR *installdir, int check_only) {
HKEY hKey;
int done = 0;
if(wcslen(installdir) < 3) {
WcaLog(LOGMSG_STANDARD, "INSTALLDIR is suspiciously short, better not do anything.");
return 0;
}
if(check_only == 0) {
WcaLog(LOGMSG_STANDARD, "Determining number of matching services...");
int servicecount = remove_service(installdir, 1);
if(servicecount <= 0) {
WcaLog(LOGMSG_STANDARD, "No services found, not removing anything.");
return 0;
} else if(servicecount == 1) {
TCHAR buf[256];
swprintf_s(buf, sizeof(buf), TEXT("There is a service called '%ls' set up to run from this installation. Do you wish me to stop and remove that service?"), last_service_name);
int rc = MessageBox(NULL, buf, TEXT("Removing MySQL Server"), MB_ICONQUESTION|MB_YESNOCANCEL|MB_SYSTEMMODAL);
if(rc == IDCANCEL) return -1;
if(rc != IDYES) return 0;
} else if(servicecount > 0) {
TCHAR buf[256];
swprintf_s(buf, sizeof(buf), TEXT("There appear to be %d services set up to run from this installation. Do you wish me to stop and remove those services?"), servicecount);
int rc = MessageBox(NULL, buf, TEXT("Removing MySQL Server"), MB_ICONQUESTION|MB_YESNOCANCEL|MB_SYSTEMMODAL);
if(rc == IDCANCEL) return -1;
if(rc != IDYES) return 0;
}
}
if(check_only == -1) check_only = 0;
WcaLog(LOGMSG_STANDARD, "Looking for service...");
WcaLog(LOGMSG_STANDARD, "INSTALLDIR = %ls", installdir);
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, TEXT("SYSTEM\\CurrentControlSet\\services"), 0, KEY_READ, &hKey)==ERROR_SUCCESS) {
DWORD index = 0;
TCHAR keyname[1024];
DWORD keylen = sizeof(keyname);
FILETIME t;
/* Go through all services in the registry */
while(RegEnumKeyExW(hKey, index, keyname, &keylen, NULL, NULL, NULL, &t) == ERROR_SUCCESS) {
HKEY hServiceKey = 0;
TCHAR path[1024];
DWORD pathlen = sizeof(path)-1;
if (RegOpenKeyExW(hKey, keyname, NULL, KEY_READ, &hServiceKey) == ERROR_SUCCESS) {
/* Look at the ImagePath value of each service */
if (RegQueryValueExW(hServiceKey, TEXT("ImagePath"), NULL, NULL, (LPBYTE)path, &pathlen) == ERROR_SUCCESS) {
path[pathlen] = 0;
TCHAR *p = path;
if(p[0] == '"') p += 1;
/* See if it is similar to our install directory */
if(wcsncmp(p, installdir, wcslen(installdir)) == 0) {
WcaLog(LOGMSG_STANDARD, "Found service '%ls' with ImagePath '%ls'.", keyname, path);
swprintf_s(last_service_name, sizeof(last_service_name), TEXT("%ls"), keyname);
/* If we are supposed to stop and remove the service... */
if(!check_only) {
WcaLog(LOGMSG_STANDARD, "Trying to stop the service.");
SC_HANDLE hSCM = NULL;
hSCM = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT);
if(hSCM != NULL) {
SC_HANDLE hService = NULL;
hService = OpenService(hSCM, keyname, SERVICE_STOP|SERVICE_QUERY_STATUS|DELETE);
if(hService != NULL) {
WcaLog(LOGMSG_STANDARD, "Waiting for the service to stop...");
SERVICE_STATUS status;
/* Attempt to stop the service */
if(ControlService(hService, SERVICE_CONTROL_STOP, &status)) {
/* Now wait until it's stopped */
while("it's one big, mean and cruel world out there") {
if(!QueryServiceStatus(hService, &status)) break;
if(status.dwCurrentState == SERVICE_STOPPED) break;
Sleep(1000);
}
WcaLog(LOGMSG_STANDARD, "Stopped the service.");
}
/* Mark the service for deletion */
DeleteService(hService);
CloseServiceHandle(hService);
}
CloseServiceHandle(hSCM);
}
}
done++;
}
}
RegCloseKey(hServiceKey);
}
index++;
keylen = sizeof(keyname)-1;
}
RegCloseKey(hKey);
} else {
WcaLog(LOGMSG_STANDARD, "Can't seem to go through the list of installed services in the registry.");
}
return done;
}
UINT wrap(MSIHANDLE hInstall, char *name, int check_only) {
HRESULT hr = S_OK;
UINT er = ERROR_SUCCESS;
hr = WcaInitialize(hInstall, name);
ExitOnFailure(hr, "Failed to initialize");
WcaLog(LOGMSG_STANDARD, "Initialized.");
TCHAR INSTALLDIR[1024];
DWORD INSTALLDIR_size = sizeof(INSTALLDIR);
if(MsiGetPropertyW(hInstall, TEXT("CustomActionData"), INSTALLDIR, &INSTALLDIR_size) == ERROR_SUCCESS) {
int rc = remove_service(INSTALLDIR, check_only);
if(rc < 0) {
er = ERROR_CANCELLED;
}
} else {
er = ERROR_CANT_ACCESS_FILE;
}
LExit:
return WcaFinalize(er);
}
UINT __stdcall RemoveServiceNoninteractive(MSIHANDLE hInstall)
{
return wrap(hInstall, "RemoveServiceNoninteractive", -1);
}
UINT __stdcall RemoveService(MSIHANDLE hInstall)
{
return wrap(hInstall, "RemoveService", 0);
}
UINT __stdcall TestService(MSIHANDLE hInstall)
{
return wrap(hInstall, "TestService", 1);
}
/* DllMain - Initialize and cleanup WiX custom action utils */
extern "C" BOOL WINAPI DllMain(
__in HINSTANCE hInst,
__in ULONG ulReason,
__in LPVOID
)
{
switch(ulReason)
{
case DLL_PROCESS_ATTACH:
WcaGlobalInitialize(hInst);
break;
case DLL_PROCESS_DETACH:
WcaGlobalFinalize();
break;
}
return TRUE;
}
LIBRARY "wixca"
VERSION 1.0
EXPORTS
RemoveService
RemoveServiceNoninteractive
TestService
#include "afxres.h"
#undef APSTUDIO_READONLY_SYMBOLS
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x0L
FILESUBTYPE 0x0L
BEGIN
END
...@@ -8,6 +8,7 @@ SET(MAJOR_VERSION "@MAJOR_VERSION@") ...@@ -8,6 +8,7 @@ SET(MAJOR_VERSION "@MAJOR_VERSION@")
SET(MINOR_VERSION "@MINOR_VERSION@") SET(MINOR_VERSION "@MINOR_VERSION@")
SET(PATCH "@PATCH@") SET(PATCH "@PATCH@")
SET(CMAKE_SIZEOF_VOID_P @CMAKE_SIZEOF_VOID_P@) SET(CMAKE_SIZEOF_VOID_P @CMAKE_SIZEOF_VOID_P@)
SET(MANUFACTURER "@MANUFACTURER@")
IF(CMAKE_SIZEOF_VOID_P EQUAL 8) IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(Win64 " Win64='yes'") SET(Win64 " Win64='yes'")
...@@ -97,6 +98,7 @@ FOREACH(f ${WIX_FEATURES}) ...@@ -97,6 +98,7 @@ FOREACH(f ${WIX_FEATURES})
<Feature Id='${f_upper}' <Feature Id='${f_upper}'
Title='${TITLE}' Title='${TITLE}'
Description='${DESCRIPTION}' Description='${DESCRIPTION}'
ConfigurableDirectory='INSTALLDIR'
Level='${Level}' ${DISPLAY} >" Level='${Level}' ${DISPLAY} >"
) )
FOREACH(c ${${f}_COMPONENTS}) FOREACH(c ${${f}_COMPONENTS})
...@@ -127,6 +129,7 @@ FOREACH(f ${WIX_FEATURES}) ...@@ -127,6 +129,7 @@ FOREACH(f ${WIX_FEATURES})
<Feature Id='${c}' <Feature Id='${c}'
Title='${TITLE}' Title='${TITLE}'
Description='${DESCRIPTION}' Description='${DESCRIPTION}'
ConfigurableDirectory='INSTALLDIR'
Level='${Level}'> Level='${Level}'>
<ComponentGroupRef Id='componentgroup.${c}'/> <ComponentGroupRef Id='componentgroup.${c}'/>
</Feature>") </Feature>")
...@@ -286,12 +289,23 @@ ENDFOREACH() ...@@ -286,12 +289,23 @@ ENDFOREACH()
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_server.wxs.in CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_server.wxs.in
${CMAKE_CURRENT_BINARY_DIR}/mysql_server.wxs) ${CMAKE_CURRENT_BINARY_DIR}/mysql_server.wxs)
SET(EXTRA_CANDLE_ARGS)
IF("$ENV{EXTRA_CANDLE_ARGS}")
SET(EXTRA_CANDLE_ARGS "$ENV{EXTRA_CANDLE_ARGS}")
ENDIF()
SET(EXTRA_LIGHT_ARGS)
IF("$ENV{EXTRA_LIGHT_ARGS}")
SET(EXTRA_LIGHT_ARGS "$ENV{EXTRA_LIGHT_ARGS}")
ENDIF()
FILE(REMOVE mysql_server.wixobj) FILE(REMOVE mysql_server.wixobj)
EXECUTE_PROCESS( EXECUTE_PROCESS(
COMMAND ${CANDLE_EXECUTABLE} -ext WixUtilExtension mysql_server.wxs COMMAND ${CANDLE_EXECUTABLE} -ext WixUtilExtension mysql_server.wxs ${EXTRA_CANDLE_ARGS}
) )
EXECUTE_PROCESS( EXECUTE_PROCESS(
COMMAND ${LIGHT_EXECUTABLE} -ext WixUIExtension -ext WixUtilExtension COMMAND ${LIGHT_EXECUTABLE} -ext WixUIExtension -ext WixUtilExtension
mysql_server.wixobj -out ${CPACK_PACKAGE_FILE_NAME}.msi mysql_server.wixobj -out ${CPACK_PACKAGE_FILE_NAME}.msi
${EXTRA_LIGHT_ARGS}
) )
<Include xmlns="http://schemas.microsoft.com/wix/2006/wi" <Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"> xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<DirectoryRef Id='TARGETDIR'>
<Component Id="RegKeys" Guid="*">
<RegistryKey
Id='MySQLKey'
Root='HKLM'
Key='SOFTWARE\MySQL AB\[ProductName]'
Action='createAndRemoveOnUninstall'>
<RegistryValue
Type='string'
Name='Location'
Value='[INSTALLDIR]'/>
<RegistryValue
Type="string"
Name="Version"
Value="[ProductVersion]"/>
<RegistryValue
Type="string"
Name="DataLocation"
Value="[DATADIR]"/>
</RegistryKey>
</Component>
</DirectoryRef>
<Feature
Id='RegKeys'
Display='hidden'
Level='1'>
<ComponentRef Id='RegKeys'/>
</Feature>
<!-- Datafiles that installation will copy to CommonAppData (initial database) <!-- Datafiles that installation will copy to CommonAppData (initial database)
They are declared Permanent and NeverOverwrite since it is user data --> They are declared Permanent and NeverOverwrite since it is user data -->
...@@ -43,7 +14,6 @@ ...@@ -43,7 +14,6 @@
<util:PermissionEx User="[LogonUser]" GenericAll="yes" /> <util:PermissionEx User="[LogonUser]" GenericAll="yes" />
</CreateFolder> </CreateFolder>
</Component> </Component>
<Directory Id="datadir.mysql.mysqlserver.data" Name="data"> <Directory Id="datadir.mysql.mysqlserver.data" Name="data">
<Directory Id="datadir.mysql.mysqlserver.data.mysql" Name="mysql"> <Directory Id="datadir.mysql.mysqlserver.data.mysql" Name="mysql">
<Component Id="component.datadir.mysql" <Component Id="component.datadir.mysql"
...@@ -72,9 +42,8 @@ ...@@ -72,9 +42,8 @@
</Directory> </Directory>
</DirectoryRef> </DirectoryRef>
<Feature Id="UserEditableDatafiles" Level='1' Display='hidden' ConfigurableDirectory="DATADIR"> <Feature Id="UserEditableDatafiles" Level='1' Display='hidden' ConfigurableDirectory="DATADIR">
<ComponentRef Id="component.datadir"/> <ComponentRef Id="component.datadir"/>
<ComponentRef Id="component.datadir.mysql"/> <ComponentRef Id="component.datadir.mysql"/>
<ComponentRef Id="component.datadir.performance_schema"/> <ComponentRef Id="component.datadir.performance_schema"/>
<ComponentRef Id="component.datadir.test"/> <ComponentRef Id="component.datadir.test"/>
......
...@@ -6,12 +6,12 @@ ...@@ -6,12 +6,12 @@
Name="MySQL Server @MAJOR_VERSION@.@MINOR_VERSION@" Name="MySQL Server @MAJOR_VERSION@.@MINOR_VERSION@"
Version="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@" Version="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@"
Language="1033" Language="1033"
Manufacturer="MySQL AB"> Manufacturer="@MANUFACTURER@">
<Package Id='*' <Package Id='*'
Keywords='Installer' Keywords='Installer'
Description="MySQL Database Server" Description="MySQL Database Server"
Manufacturer='MySQL AB' Manufacturer='@MANUFACTURER@'
InstallerVersion='200' InstallerVersion='200'
Languages='1033' Languages='1033'
Compressed='yes' Compressed='yes'
...@@ -57,6 +57,34 @@ ...@@ -57,6 +57,34 @@
Id="ARPPRODUCTICON" Id="ARPPRODUCTICON"
Value="icon.ico" /> Value="icon.ico" />
<!-- License -->
<WixVariable
Id="WixUILicenseRtf"
Value="@CMAKE_CURRENT_BINARY_DIR@/COPYING.rtf"/>
<!-- How to remove the service on uninstall -->
<Binary Id='wixca.dll' SourceFile='@CMAKE_CURRENT_BINARY_DIR@/ca/RelWithDebInfo/wixca.dll' />
<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</Custom>
<Custom Action="UnregisterPropertySilent" After="InstallInitialize">Installed And Not UPGRADINGPRODUCTCODE</Custom>
<Custom Action="UnregisterService" After="UnregisterProperty">Installed And Not UPGRADINGPRODUCTCODE And UILevel&gt;2</Custom>
<Custom Action="UnregisterServiceSilently" After="UnregisterPropertySilent">Installed And Not UPGRADINGPRODUCTCODE And UILevel&lt;=2</Custom>
</InstallExecuteSequence>
<!-- Installation root--> <!-- Installation root-->
<Directory Id='TARGETDIR' Name='SourceDir'> <Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='@PlatformProgramFilesFolder@'> <Directory Id='@PlatformProgramFilesFolder@'>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment