From dd9ff1276dcb7ae576cb1046205f16e1d0601fa1 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Sat, 24 Jul 2010 17:26:45 +0200 Subject: [PATCH] Bug#55169: Installer does not preserve user's settings in custom mode Fix some issues with WiX packaging, particularly major upgrade and change scenarios. * remember binary location and data location (for major upgrade) * use custom UI, which is WiX Mondo extended for major upgrade dialog (no feature selection screen shown on major upgrade, only upgrade confirmation). This is necessary to prevent changing installation path during upgrade (services are not reregistered, so they would have invalid binary path is it is changed) * Hide datafiles that are installed into ProgramFiles, show ones that are installed in ProgramData * Make MSI buildable with nmake * Fix autotools "make dist" --- Makefile.am | 2 + configure.in | 2 +- packaging/Makefile.am | 14 ++++++ packaging/WiX/CMakeLists.txt | 42 ++++++++-------- packaging/WiX/CPackWixConfig.cmake | 2 +- packaging/WiX/create_msi.cmake.in | 24 ++++++--- packaging/WiX/custom_ui.wxs | 81 ++++++++++++++++++++++++++++++ packaging/WiX/extra.wxs.in | 6 ++- packaging/WiX/mysql_server.wxs.in | 59 ++++++++++++++++++++-- 9 files changed, 196 insertions(+), 36 deletions(-) create mode 100644 packaging/Makefile.am create mode 100644 packaging/WiX/custom_ui.wxs diff --git a/Makefile.am b/Makefile.am index 297e923905e..a559972969b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -30,6 +30,7 @@ SUBDIRS = . include @docs_dirs@ @zlib_dir@ \ @libmysqld_dirs@ \ mysql-test support-files sql-bench \ win \ + packaging \ cmake DIST_SUBDIRS = . include Docs zlib \ cmd-line-utils sql-common scripts \ @@ -40,6 +41,7 @@ DIST_SUBDIRS = . include Docs zlib \ mysql-test support-files sql-bench \ win \ cmake \ + packaging \ BUILD DISTCLEANFILES = ac_available_languages_fragment diff --git a/configure.in b/configure.in index f90a68b241d..345c616cf67 100644 --- a/configure.in +++ b/configure.in @@ -3059,7 +3059,7 @@ AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl libmysqld/Makefile libmysqld/examples/Makefile dnl mysql-test/Makefile mysql-test/lib/My/SafeProcess/Makefile dnl sql-bench/Makefile include/mysql_version.h plugin/Makefile win/Makefile dnl - cmake/Makefile + cmake/Makefile packaging/Makefile ) AC_CONFIG_COMMANDS([default], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h) diff --git a/packaging/Makefile.am b/packaging/Makefile.am new file mode 100644 index 00000000000..3e6a79367b6 --- /dev/null +++ b/packaging/Makefile.am @@ -0,0 +1,14 @@ +EXTRA_DIST = \ + WiX/AdminBackground.jpg \ + WiX/AdminHeader.jpg \ + WiX/CMakeLists.txt \ + WiX/extra.wxs.in \ + WiX/CPackWixConfig.cmake \ + WiX/create_msi.cmake.in \ + WiX/custom_ui.wxs \ + WiX/MySQLServer.ico \ + WiX/mysql_server.wxs.in \ + WiX/ca/CMakeLists.txt \ + WiX/ca/CustomAction.cpp \ + WiX/ca/CustomAction.def \ + WiX/ca/CustomAction.rc diff --git a/packaging/WiX/CMakeLists.txt b/packaging/WiX/CMakeLists.txt index 8a6a4ae4c41..052887f10a1 100644 --- a/packaging/WiX/CMakeLists.txt +++ b/packaging/WiX/CMakeLists.txt @@ -41,11 +41,13 @@ FOREACH(dir mysql performance_schema) FILE(GLOB files ${CMAKE_BINARY_DIR}/sql/data/${dir}/*) SET(filelist) FOREACH(f ${files}) + IF(NOT f MATCHES ".rule") FILE(TO_NATIVE_PATH "${f}" file_native_path) GET_FILENAME_COMPONENT(file_name "${f}" NAME) SET(filelist "${filelist} ") + ENDIF() ENDFOREACH() STRING(TOUPPER ${dir} DIR_UPPER) SET(DATADIR_${DIR_UPPER}_FILES "${filelist}") @@ -56,15 +58,34 @@ FIND_PROGRAM(HEAT_EXECUTABLE heat ${WIX_DIR}) FIND_PROGRAM(CANDLE_EXECUTABLE candle ${WIX_DIR}) FIND_PROGRAM(LIGHT_EXECUTABLE light ${WIX_DIR}) +# 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") + SET(COPYING_RTF "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.rtf") +ELSE() + 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") + SET(COPYING_RTF "${CMAKE_CURRENT_BINARY_DIR}/COPYING.rtf") +ENDIF() +GET_TARGET_PROPERTY(WIXCA_LOCATION wixca LOCATION) +SET(CPACK_WIX_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/CPackWixConfig.cmake) +SET(CPACK_WIX_INCLUDE "${CMAKE_CURRENT_BINARY_DIR}/extra.wxs;${CMAKE_CURRENT_SOURCE_DIR}/custom_ui.wxs") + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/create_msi.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/create_msi.cmake @ONLY) + IF(CMAKE_SIZEOF_VOID_P EQUAL 8) SET(WixWin64 " Win64='yes'") ELSE() SET(WixWin64) ENDIF() + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/extra.wxs.in ${CMAKE_CURRENT_BINARY_DIR}/extra.wxs) @@ -72,28 +93,11 @@ IF(CMAKE_GENERATOR MATCHES "Visual Studio") SET(CONFIG_PARAM "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_CFG_INTDIR}") 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 ) @@ -103,10 +107,8 @@ 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) +ADD_DEPENDENCIES(MSI_ESSENTIALS wixca) diff --git a/packaging/WiX/CPackWixConfig.cmake b/packaging/WiX/CPackWixConfig.cmake index 0413b699fc5..f49406b5787 100644 --- a/packaging/WiX/CPackWixConfig.cmake +++ b/packaging/WiX/CPackWixConfig.cmake @@ -1,6 +1,5 @@ IF(ESSENTIALS) - MESSAGE("Essentials!") SET(CPACK_COMPONENTS_USED "Server;Client;DataFiles") SET(CPACK_WIX_UI "WixUI_InstallDir") IF(CMAKE_SIZEOF_VOID_P MATCHES 8) @@ -60,6 +59,7 @@ SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DESCRIPTION "Install MySQL Server") SET(CPACK_COMPONENT_DATAFILES_GROUP "MySQLServer") SET(CPACK_COMPONENT_DATAFILES_DISPLAY_NAME "Server data files") SET(CPACK_COMPONENT_DATAFILES_DESCRIPTION "Server data files" ) + SET(CPACK_COMPONENT_DATAFILES_HIDDEN 1) #Feature "Devel" diff --git a/packaging/WiX/create_msi.cmake.in b/packaging/WiX/create_msi.cmake.in index d6725e9ae6c..adc3cf4c4dd 100644 --- a/packaging/WiX/create_msi.cmake.in +++ b/packaging/WiX/create_msi.cmake.in @@ -10,6 +10,10 @@ SET(MINOR_VERSION "@MINOR_VERSION@") SET(PATCH "@PATCH@") SET(CMAKE_SIZEOF_VOID_P @CMAKE_SIZEOF_VOID_P@) SET(MANUFACTURER "@MANUFACTURER@") +SET(WIXCA_LOCATION "@WIXCA_LOCATION@") +SET(COPYING_RTF "@COPYING_RTF@") +SET(CPACK_WIX_CONFIG "@CPACK_WIX_CONFIG@") +SET(CPACK_WIX_INCLUDE "@CPACK_WIX_INCLUDE@") IF(CMAKE_SIZEOF_VOID_P EQUAL 8) SET(Win64 " Win64='yes'") @@ -30,7 +34,7 @@ IF(CPACK_WIX_CONFIG) ENDIF() IF(NOT CPACK_WIX_UI) - SET(CPACK_WIX_UI "WixUI_Mondo") + SET(CPACK_WIX_UI "WixUI_Mondo_Custom") ENDIF() SET(WIX_FEATURES) @@ -144,15 +148,16 @@ FOREACH(f ${WIX_FEATURES}) ENDFOREACH() +IF(CMAKE_INSTALL_CONFIG_NAME) + STRING(REPLACE "${CMAKE_CFG_INTDIR}" "${CMAKE_INSTALL_CONFIG_NAME}" + WIXCA_LOCATION "${WIXCA_LOCATION}") + SET(CONFIG_PARAM "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_INSTALL_CONFIG_NAME}") +ENDIF() CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_server.wxs.in ${CMAKE_CURRENT_BINARY_DIR}/mysql_server.wxs) -IF(CMAKE_INSTALL_CONFIG_NAME) - SET(CONFIG_PARAM "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_INSTALL_CONFIG_NAME}") -ENDIF() - FOREACH(comp ${CPACK_COMPONENTS_ALL}) SET(ENV{DESTDIR} testinstall/${comp}) SET(DIRS ${DIRS} testinstall/${comp}) @@ -262,9 +267,12 @@ FOREACH(d ${DIRS}) SET(COMP_NAME ${d_name}) TRAVERSE_FILES(${d} ${d} ${abs}/${d_name}.wxs ${abs}/${d_name}_component_group.wxs "${abs}/dirs") FILE(APPEND ${abs}/${d_name}_component_group.wxs "") - FILE(READ ${d_name}.wxs WIX_TMP) - SET(CPACK_WIX_COMPONENTS "${CPACK_WIX_COMPONENTS}\n${WIX_TMP}") - FILE(REMOVE ${d_name}.wxs) + IF(EXISTS ${d_name}.wxs) + FILE(READ ${d_name}.wxs WIX_TMP) + SET(CPACK_WIX_COMPONENTS "${CPACK_WIX_COMPONENTS}\n${WIX_TMP}") + FILE(REMOVE ${d_name}.wxs) + ENDIF() + FILE(READ ${d_name}_component_group.wxs WIX_TMP) SET(CPACK_WIX_COMPONENT_GROUPS "${CPACK_WIX_COMPONENT_GROUPS}\n${WIX_TMP}") diff --git a/packaging/WiX/custom_ui.wxs b/packaging/WiX/custom_ui.wxs new file mode 100644 index 00000000000..90db5c416fe --- /dev/null +++ b/packaging/WiX/custom_ui.wxs @@ -0,0 +1,81 @@ + + + + + + 1]]> + OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND (PROMPTROLLBACKCOST="P" OR NOT PROMPTROLLBACKCOST) + OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D" + OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D" + (OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 1) OR (OutOfDiskSpace = 1 AND PROMPTROLLBACKCOST="F") + + + 1 + + + WixUI_InstallMode = "Remove" + + + + + + + + + + + + + + + + + + + + + + 1 + + NOT OLDERVERSIONBEINGUPGRADED + OLDERVERSIONBEINGUPGRADED + + 1 + LicenseAccepted = "1" + + 1 + 1 + 1 + 1 + + WixUI_InstallMode = "Change" + WixUI_InstallMode = "InstallCustom" + 1 + + WixUI_InstallMode = "InstallCustom" + WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = "InstallComplete" + WixUI_InstallMode = "Change" + WixUI_InstallMode = "Repair" OR WixUI_InstallMode = "Remove" + + 1 + + 1 + 1 + 1 + 1 + + 1 + + + + diff --git a/packaging/WiX/extra.wxs.in b/packaging/WiX/extra.wxs.in index b6c42136129..fe2e73c3340 100644 --- a/packaging/WiX/extra.wxs.in +++ b/packaging/WiX/extra.wxs.in @@ -48,7 +48,11 @@ - + diff --git a/packaging/WiX/mysql_server.wxs.in b/packaging/WiX/mysql_server.wxs.in index 8b20644e58d..59cc817a302 100644 --- a/packaging/WiX/mysql_server.wxs.in +++ b/packaging/WiX/mysql_server.wxs.in @@ -26,7 +26,9 @@ Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.0" IncludeMinimum="yes" Maximum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@" - Property="OLDERVERSIONBEINGUPGRADED" /> + Property="OLDERVERSIONBEINGUPGRADED" + MigrateFeatures="yes" + /> + + + + + NOT + Installed + + + + + + + + + + + + + + + + + + + + + + + INSTALLDIR2 + + @@ -60,10 +109,10 @@ + Value="@COPYING_RTF@"/> - + Installed And Not UPGRADINGPRODUCTCODE Installed And Not UPGRADINGPRODUCTCODE - Installed And Not UPGRADINGPRODUCTCODE And UILevel>2 - Installed And Not UPGRADINGPRODUCTCODE And UILevel<=2 + Installed And Not UPGRADINGPRODUCTCODE And UILevel>4 + Installed And Not UPGRADINGPRODUCTCODE And UILevel<=4