#At file:///C:/src/bzr.mysql/wex/installer/ based on revid:iggy@stripped
339 Iggy Galarza 2011-02-16
Fixed faiure to remove application directory when uninstall launched from UI.
Added Example 5.5.msi to manifest-base.xml
Improved file removal custom action to also remove top level directory if empty.
modified:
MySQLCA/CustomAction.cs
Setup/Product.wxs
Setup/SetupWeb.wxs
Setup/manifest-base.xml
WexInstaller/RemovePanels/RemoveComplete.cs
=== modified file 'MySQLCA/CustomAction.cs'
--- a/MySQLCA/CustomAction.cs 2011-02-14 15:42:24 +0000
+++ b/MySQLCA/CustomAction.cs 2011-02-16 19:30:10 +0000
@@ -41,39 +41,65 @@ namespace MySQLCA
[CustomAction]
public static ActionResult DeleteFiles(Session session)
{
+ ActionResult thisResult = ActionResult.Failure;
+
session.Log("Begin DeleteFiles");
- //StreamWriter writer = new StreamWriter(@"c:\\test.txt", false);
- try
+ string[] arguments = GetCustomActionDataArguments(session);
+
+ if (arguments == null || arguments.Length != 2)
+ {
+ session.Log("Error retrieving directories to delete");
+ }
+ else
{
- string[] arguments = GetCustomActionDataArguments(session);
+ session.Log("Attempting to remove direectories");
- //writer.WriteLine("Deleting data");
- if (arguments == null || arguments.Length != 2)
+ for (int i = 0; i < 2; i++)
{
- session.Log("Error retrieving directories to delete");
- return ActionResult.Failure;
+ try
+ {
+ string targetDirectory = arguments[i].ToString().TrimEnd('\\');
+ string targetParent = Directory.GetParent(targetDirectory).FullName;
+
+ session.Log(String.Format("Deleting: {0}", targetDirectory));
+ Directory.Delete(targetDirectory, true);
+ session.Log(String.Format("Deleted: {0}", targetDirectory));
+
+ session.Log(String.Format("Checking for empty parent: {0}", targetParent));
+ if (IsDirectoryEmpty(targetParent))
+ {
+ session.Log(String.Format("Deleting: {0}", targetParent));
+ Directory.Delete(targetParent, true);
+ session.Log(String.Format("Deleted: {0}", targetParent));
+ }
+
+ thisResult = ActionResult.Success;
+ }
+ catch (Exception ex)
+ {
+ session.Log(ex.Message);
+ thisResult = ActionResult.Failure;
+ }
}
- Directory.Delete(arguments[0], true);
- Directory.Delete(arguments[1], true);
- //DeleteFolder(arguments[0]);
- //DeleteFolder(arguments[1]);
- //writer.WriteLine("success");
}
- catch (Exception ex)
+
+ return thisResult;
+ }
+
+ private static bool IsDirectoryEmpty(string targetDirectory)
+ {
+ bool directoryEmpty = false;
+
+ if (Directory.Exists(targetDirectory))
{
- //writer.WriteLine("ex type = " + ex.ToString());
- //writer.WriteLine("ex type = " + ex.GetType());
- //writer.WriteLine("error = " + ex.Message);
- //writer.Flush();
- //writer.Close();
- session.Log(ex.Message);
- return ActionResult.Failure;
+ string[] directoryListing = Directory.GetDirectories(targetDirectory);
+ string[] fileListing = Directory.GetFiles(targetDirectory);
+
+ directoryEmpty = ((directoryListing.Length == 0) && (fileListing.Length == 0));
}
- //writer.Flush();
- //writer.Close();
- return ActionResult.Success;
+ return directoryEmpty;
}
private static void DeleteFolder(string path)
=== modified file 'Setup/Product.wxs'
--- a/Setup/Product.wxs 2011-02-14 19:40:32 +0000
+++ b/Setup/Product.wxs 2011-02-16 19:30:10 +0000
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<?define ProductName="MySQL Universal Installer"?>
-<?define ProductVersion="1.0.8.0"?>
+<?define ProductVersion="1.0.6.0"?>
<?define CatalogName="mysql-5.5-gpl"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Id="*" Name="$(var.ProductName)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="Oracle" UpgradeCode="87973E15-B594-4EC5-B80F-6BBF4623E7C4">
@@ -18,7 +18,7 @@
<Directory Id="ProgramFilesFolder">
<Directory Id="MySQL" Name="MySQL">
<Directory Id="INSTALLLOCATION" Name="MySQL Universal Installer">
- <Component Id="WexInstaller.exe" Guid="">
+ <Component Id="WexInstaller.exe" Guid="763E4044-ADE9-4405-BA09-2AE4E84056CF">
<File Id="WexInstaller.exe" Name="UniversalInstaller.exe" KeyPath="yes" Source="$(var.ProjectDir)..\WexInstaller\bin\$(var.Configuration)\WexInstaller.exe"/>
<File Id="WexInstallerUpdater.exe" Name="WexInstallerUpdater.exe" Source="$(var.ProjectDir)..\WexInstallerUpdater\bin\$(var.Configuration)\WexInstallerUpdater.exe"/>
<File Id="MySql.Data.dll" Name="MySql.Data.dll" Source="$(var.ProjectDir)..\WexInstaller\bin\$(var.Configuration)\mysql.data.dll"/>
@@ -33,7 +33,6 @@
<Directory Id='PMCompanyDir' Name='MySQL'>
<Directory Id="ShortCutDir" Name="$(var.ProductName)">
<Component Id="C_ShortCut" Guid="53607E47-D408-43A6-83B6-08D61AFED809">
- <CreateFolder/>
<Shortcut Id="AppStartMenuShortCut" Name="MySQL Universal Installer" Target="[INSTALLLOCATION]\UniversalInstaller.exe" WorkingDirectory="INSTALLLOCATION" Icon="InstallerIcon.exe"/>
<RemoveFolder Id="DeleteShortcutFolder1" Directory="PMCompanyDir" On="uninstall" />
<RemoveFolder Id="DeleteShortcutFolder2" Directory="ShortCutDir" On="uninstall" />
@@ -43,13 +42,11 @@
</Directory>
</Directory>
- <!--
- Install config.xml and products.xml under CommonAppDataFolder\MySQL\MySQL Universal Installer
- -->
+ <!-- Install config.xml and products.xml under CommonAppDataFolder\MySQL\MySQL Universal Installer -->
<Directory Id="CommonAppDataFolder">
<Directory Id="CommonAppDataFolder_MySQL" Name="MySQL">
<Directory Id="UniversalInstaller" Name="MySQL Universal Installer">
- <Component Id="ConfigFiles" Guid="">
+ <Component Id="ConfigFiles" Guid="C0DB3944-2200-4329-9D92-3D39D92A421F">
<File Id="config.xml" Name="config.xml" Source="config.xml"/>
<util:XmlFile Id="SetProductCachePath" Action="setValue" ElementPath="//ProductCachePath" Value="[ProductCache]" File="[#config.xml]" SelectionLanguage="XPath" Sequence="1" />
<util:XmlFile Id="SetInstallationRoot" Action="setValue" ElementPath="//InstallationRoot" Value="[INSTALLLOCATION]" File="[#config.xml]" SelectionLanguage="XPath" Sequence="2" />
@@ -59,7 +56,7 @@
<File Id="mytemplate.ini" Name="my-template.ini" Source="my-template.ini"/>
</Component>
<Directory Id="ProductCache" Name="Product Cache">
- <Component Id="Products" Guid="">
+ <Component Id="Products" Guid="88D9D419-FCCB-4B4B-881E-FAE4D29C81B9" Permanent="yes">
<File Id="server51" Name="mysql-5.1.54-win32.msi" Source="ProductCache\mysql-5.1.54-win32.msi"/>
<File Id="server55" Name="mysql-5.5.8-win32.msi" Source="ProductCache\mysql-5.5.8-win32.msi"/>
<File Id="workbench" Name="mysql-workbench-gpl-5.2.31a-win32.msi" Source="ProductCache\mysql-workbench-gpl-5.2.31a-win32.msi"/>
@@ -101,8 +98,8 @@
<Custom Action="SetLaunchApp" After="PublishProduct"/>
<Custom Action="LaunchApp" After="SetLaunchApp">NOT(REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE)</Custom>
- <Custom Action="DeleteFiles.SetProperty" After="RemoveFiles">REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE</Custom>
- <Custom Action="DeleteFiles" After="DeleteFiles.SetProperty">REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE</Custom>
+ <Custom Action="DeleteFiles.SetProperty" Before="DeleteFiles">REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE</Custom>
+ <Custom Action="DeleteFiles" Before="InstallFinalize">REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE</Custom>
</InstallExecuteSequence>
</Product>
=== modified file 'Setup/SetupWeb.wxs'
--- a/Setup/SetupWeb.wxs 2011-02-09 23:58:01 +0000
+++ b/Setup/SetupWeb.wxs 2011-02-16 19:30:10 +0000
@@ -1,18 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<?define ProductName="MySQL Universal Installer"?>
-<?define ProductVersion="1.0.8"?>
-<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
- xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension"
- xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
-
- <Product Id="*" Name="$(var.ProductName)" Language="1033" Version="$(var.ProductVersion)"
- Manufacturer="Oracle"
- UpgradeCode="87973E15-B594-4EC5-B80F-6BBF4623E7C4">
+<?define ProductVersion="1.0.8.0"?>
+<?define CatalogName="mysql-5.1-gpl"?>
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
+ <Product Id="*" Name="$(var.ProductName)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="Oracle" UpgradeCode="87973E15-B594-4EC5-B80F-6BBF4623E7C4">
<Package InstallerVersion="200" Compressed="yes" />
<Upgrade Id="87973E15-B594-4EC5-B80F-6BBF4623E7C4">
<UpgradeVersion OnlyDetect="no" Minimum="$(var.ProductVersion)" Property="NEWERVERSIONDETECTED" IncludeMinimum="no" />
<UpgradeVersion OnlyDetect="no" Maximum="$(var.ProductVersion)" Property="OLDERVERSIONBEINGUPGRADED" IncludeMaximum="yes" />
</Upgrade>
+
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Icon Id="InstallerIcon.exe" SourceFile="$(var.ProjectDir)..\WexInstaller\Resources\mysql-installer.ico"/>
<Property Id="ARPPRODUCTICON" Value="InstallerIcon.exe"/>
@@ -21,32 +18,12 @@
<Directory Id="ProgramFilesFolder">
<Directory Id="MySQL" Name="MySQL">
<Directory Id="INSTALLLOCATION" Name="MySQL Universal Installer">
- <Component Id="WexInstaller.exe" Guid="89A0E0A3-6E87-4C87-8F1D-6DC3D3D21CB4" Permanent="yes">
- <File Id="WexInstaller.exe" Name="UniversalInstaller.exe" KeyPath="yes" Source="$(var.ProjectDir)..\WexInstaller\bin\$(var.Configuration)\WexInstaller.exe">
- <Shortcut Id="mainShortcut" Directory="ShortCutDir" Advertise="yes" Icon="InstallerIcon.exe"
- Name="MySQL Universal Installer" WorkingDirectory="INSTALLLOCATION"/>
- </File>
- <File Id="WexInstallerUpdater.exe" Name="WexInstallerUpdater.exe"
- Source="$(var.ProjectDir)..\WexInstallerUpdater\bin\$(var.Configuration)\WexInstallerUpdater.exe"/>
+ <Component Id="WexInstaller.exe" Guid="763E4044-ADE9-4405-BA09-2AE4E84056CF">
+ <File Id="WexInstaller.exe" Name="UniversalInstaller.exe" KeyPath="yes" Source="$(var.ProjectDir)..\WexInstaller\bin\$(var.Configuration)\WexInstaller.exe"/>
+ <File Id="WexInstallerUpdater.exe" Name="WexInstallerUpdater.exe" Source="$(var.ProjectDir)..\WexInstallerUpdater\bin\$(var.Configuration)\WexInstallerUpdater.exe"/>
<File Id="MySql.Data.dll" Name="MySql.Data.dll" Source="$(var.ProjectDir)..\WexInstaller\bin\$(var.Configuration)\mysql.data.dll"/>
<File Id="WexInstaller.Core.dll" Name="WexInstaller.Core.dll" Source="$(var.ProjectDir)..\WexInstaller\bin\$(var.Configuration)\wexinstaller.core.dll"/>
<File Id="StandardPlugins.dll" Name="StandardPlugins.dll" Source="$(var.ProjectDir)..\StandardPlugins\bin\$(var.Configuration)\standardplugins.dll"/>
- <RemoveFolder Id="DeleteShortcutFolder1" Directory="PMCompanyDir" On="uninstall" />
- <RemoveFolder Id="DeleteShortcutFolder2" Directory="ShortCutDir" On="uninstall" />
- <Registry Action="remove" Root="HKLM"
- Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\[ProductCode]" Name="DisplayVersion"/>
- </Component>
- <Component Id="C_RemoveFiles" Guid="973F9091-5868-4D4D-A9E9-AC854D2591F3">
- <Condition>NOT UPGRADINGPRODUCTCODE</Condition>
- <!-- remove program files folder -->
- <RemoveFile Id="WexInstallRemoveFiles" Directory="INSTALLLOCATION" On="uninstall" Name="*.*"/>
- <RemoveFolder Id="WexInstallRemoveFolder" Directory="INSTALLLOCATION" On="uninstall"/>
- <!-- remove cache folder -->
- <RemoveFile Id="WexRemoveCacheFiles" Directory="ProductCache" On="uninstall" Name="*.*"/>
- <RemoveFolder Id="WexRemoveCacheFolder" Directory="ProductCache" On="uninstall"/>
- <!-- remove programdata files/folder -->
- <RemoveFile Id="WexRemoveDataFiles" Directory="UniversalInstaller" On="uninstall" Name="*.*"/>
- <RemoveFolder Id="WexRemoveDataFolder" Directory="UniversalInstaller" On="uninstall"/>
</Component>
</Directory>
</Directory>
@@ -54,18 +31,27 @@
<Directory Id="ProgramMenuFolder" Name="PMFolder">
<Directory Id='PMCompanyDir' Name='MySQL'>
- <Directory Id="ShortCutDir" Name="$(var.ProductName)"/>
+ <Directory Id="ShortCutDir" Name="$(var.ProductName)">
+ <Component Id="C_ShortCut" Guid="53607E47-D408-43A6-83B6-08D61AFED809">
+ <Shortcut Id="AppStartMenuShortCut" Name="MySQL Universal Installer" Target="[INSTALLLOCATION]\UniversalInstaller.exe" WorkingDirectory="INSTALLLOCATION" Icon="InstallerIcon.exe"/>
+ <RemoveFolder Id="DeleteShortcutFolder1" Directory="PMCompanyDir" On="uninstall" />
+ <RemoveFolder Id="DeleteShortcutFolder2" Directory="ShortCutDir" On="uninstall" />
+ <RegistryValue Root="HKCU" Key="Software\MySQL\$(var.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
+ </Component>
+ </Directory>
</Directory>
</Directory>
- <!--
- Install config.xml and products.xml under CommonAppDataFolder\MySQL\MySQL Universal Installer
- -->
+ <!-- Install config.xml and products.xml under CommonAppDataFolder\MySQL\MySQL Universal Installer -->
<Directory Id="CommonAppDataFolder">
<Directory Id="CommonAppDataFolder_MySQL" Name="MySQL">
<Directory Id="UniversalInstaller" Name="MySQL Universal Installer">
- <Component Id="ConfigFiles" Guid="">
+ <Component Id="ConfigFiles" Guid="C0DB3944-2200-4329-9D92-3D39D92A421F">
<File Id="config.xml" Name="config.xml" Source="config.xml"/>
+ <util:XmlFile Id="SetProductCachePath" Action="setValue" ElementPath="//ProductCachePath" Value="[ProductCache]" File="[#config.xml]" SelectionLanguage="XPath" Sequence="1" />
+ <util:XmlFile Id="SetInstallationRoot" Action="setValue" ElementPath="//InstallationRoot" Value="[INSTALLLOCATION]" File="[#config.xml]" SelectionLanguage="XPath" Sequence="2" />
+ <util:XmlFile Id="SetProductCode" Action="setValue" ElementPath="//ProductCode" Value="[ProductCode]" File="[#config.xml]" SelectionLanguage="XPath" Sequence="3" />
+
<File Id="products.xml" Name="products.xml.temp" Source="products.xml"/>
<File Id="mytemplate.ini" Name="my-template.ini" Source="my-template.ini"/>
</Component>
@@ -84,7 +70,7 @@
<ComponentRef Id="WexInstaller.exe" />
<ComponentRef Id="ConfigFiles" />
<ComponentRef Id="Products"/>
- <ComponentRef Id="C_RemoveFiles"/>
+ <ComponentRef Id="C_ShortCut"/>
</Feature>
<PropertyRef Id="NETFRAMEWORK35"/>
@@ -92,13 +78,21 @@
<![CDATA[Installed OR NETFRAMEWORK35]]>
</Condition>
+ <Binary Id="MySQLCA" SourceFile="MySQLCA.CA.dll"/>
+
+ <CustomAction Id="DeleteFiles" BinaryKey="MySQLCA" DllEntry="DeleteFiles" Execute="deferred" Impersonate="no" Return="ignore"/>
+ <CustomAction Id="DeleteFiles.SetProperty" Return="check" Property="DeleteFiles" Value="[UniversalInstaller],[INSTALLLOCATION]"/>
+
<CustomAction Id="SetLaunchApp" Property="LaunchAppPath" Value="[#WexInstaller.exe]"/>
- <CustomAction Id="LaunchApp" Property="LaunchAppPath" ExeCommand="" Execute="deferred" Impersonate="no" Return="asyncNoWait"/>
+ <CustomAction Id="LaunchApp" Property="LaunchAppPath" ExeCommand="$(var.CatalogName)" Execute="deferred" Impersonate="no" Return="asyncNoWait"/>
<InstallExecuteSequence>
<RemoveExistingProducts After="InstallInitialize" />
<Custom Action="SetLaunchApp" After="PublishProduct"/>
- <Custom Action="LaunchApp" After="SetLaunchApp">NOT INSTALLED OR UPGRADINGPRODUCTCODE</Custom>
+ <Custom Action="LaunchApp" After="SetLaunchApp">NOT(REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE)</Custom>
+
+ <Custom Action="DeleteFiles.SetProperty" Before="DeleteFiles">REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE</Custom>
+ <Custom Action="DeleteFiles" Before="InstallFinalize">REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE</Custom>
</InstallExecuteSequence>
</Product>
=== modified file 'Setup/manifest-base.xml'
--- a/Setup/manifest-base.xml 2011-02-14 17:48:38 +0000
+++ b/Setup/manifest-base.xml 2011-02-16 19:30:10 +0000
@@ -17,6 +17,7 @@
<CatalogProduct productId="connector-odbc" setupTypeFlags="1" />
<CatalogProduct productId="connector-c" setupTypeFlags="1" />
<CatalogProduct productId="connector-cpp" setupTypeFlags="1" />
+ <CatalogProduct productId="examples-5.5" setupTypeFlags="1"/>
</CatalogProducts>
</ProductCatalog>
<ProductCatalog id="mysql-5.1-gpl" name="MySQL 5.1" description="MySQL 5.1 Community Edition" commercial="false">
@@ -61,8 +62,7 @@
</Package>
</Packages>
</Product>
- <Product name="mysql-server-5.1-gpl" title="MySQL Server" description="The core MySQL database server"
- upgradeId="{49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3}" urlBaseDir="mysql-5.1">
+ <Product name="mysql-server-5.1-gpl" title="MySQL Server" description="The core MySQL database server" upgradeId="{49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3}" urlBaseDir="mysql-5.1">
<Packages>
<Package type="MSI" arch="X86" filename="mysql-5.1.54-win32.msi" id="{2430887C-B8A8-49D8-9185-9F451185AF7B}" thisVersion="5.1.54">
<Feature name="SERVER" title="MySQL Server" description="Install MySQL Server." default="true" size="0" display="0" hasComponents="true">
@@ -141,7 +141,14 @@
</Product>
<Product name="examples-5.1" title="Samples and Examples" description="A collection of examples and sample databases to help a developer get started." upgradeId="8C8219CB-78A4-4AF8-8D49-F36FB1FE3320" urlBaseDir="http://wb.mysql.com/installer">
<Packages>
- <Package type="MSI" arch="X86" filename="mysql-examples-5.1.0.msi" id="{46B63307-6F7C-4E85-A77B-FA97365DF153}" thisVersion="5.1.0">
+ <Package type="MSI" arch="X86" filename="mysql-examples-5.1.0.msi" id="46B63307-6F7C-4E85-A77B-FA97365DF153" thisVersion="5.1.0">
+ <Feature name="SampleDB" title="Sample Databases" description="Some interesting sample databases" default="true" size="0" display="0" hasComponents="true" />
+ </Package>
+ </Packages>
+ </Product>
+ <Product name="examples-5.5" title="Samples and Examples" description="A collection of examples and sample databases to help a developer get started." upgradeId="54831F8D-6372-4E77-9D54-59DBC93E90C6" urlBaseDir="http://wb.mysql.com/installer">
+ <Packages>
+ <Package type="MSI" arch="X86" filename="mysql-examples-5.5.0.msi" id="F53503A3-41B3-4327-A5C0-B058AB72B90D" thisVersion="5.5.0">
<Feature name="SampleDB" title="Sample Databases" description="Some interesting sample databases" default="true" size="0" display="0" hasComponents="true" />
</Package>
</Packages>
=== modified file 'WexInstaller/RemovePanels/RemoveComplete.cs'
--- a/WexInstaller/RemovePanels/RemoveComplete.cs 2011-02-08 14:34:41 +0000
+++ b/WexInstaller/RemovePanels/RemoveComplete.cs 2011-02-16 19:30:10 +0000
@@ -78,8 +78,9 @@ namespace WexInstaller
Process p = new Process();
p.StartInfo.FileName = "msiexec.exe";
+ p.StartInfo.WorkingDirectory = Path.GetTempPath();
p.StartInfo.Arguments = commandLine;
- p.Start();
+ p.Start();
}
catch (Exception e)
{
Attachment: [text/bzr-bundle] bzr/iggy@mysql.com-20110216193010-n2sb00fepz0xj17a.bundle
| Thread |
|---|
| • bzr commit into wex-installer-1.0 branch (iggy:339) | Iggy Galarza | 16 Feb |