mirror of
https://github.com/MariaDB/server.git
synced 2025-01-28 17:54:16 +01:00
MDEV-27546 MSI should fail if INSTALLDIR is a non-empty existing directory
Make installer fail if INSTALLDIR exists. In UI mode, show a popup and disable "Next" button until install root is corrected
This commit is contained in:
parent
12cea09713
commit
8c457dad48
3 changed files with 36 additions and 1 deletions
|
@ -187,6 +187,27 @@ bool IsDirectoryEmptyOrNonExisting(const wchar_t *dir) {
|
|||
return empty;
|
||||
}
|
||||
|
||||
extern "C" UINT __stdcall CheckInstallDirectory(MSIHANDLE hInstall)
|
||||
{
|
||||
HRESULT hr= S_OK;
|
||||
UINT er= ERROR_SUCCESS;
|
||||
wchar_t *path= 0;
|
||||
|
||||
hr= WcaInitialize(hInstall, __FUNCTION__);
|
||||
ExitOnFailure(hr, "Failed to initialize");
|
||||
WcaGetFormattedString(L"[INSTALLDIR]", &path);
|
||||
if (!IsDirectoryEmptyOrNonExisting(path))
|
||||
{
|
||||
wchar_t msg[2*MAX_PATH];
|
||||
swprintf(msg,countof(msg), L"Installation directory '%s' exists and is not empty. Choose a "
|
||||
"different install directory",path);
|
||||
WcaSetProperty(L"INSTALLDIRERROR", msg);
|
||||
}
|
||||
LExit:
|
||||
ReleaseStr(path);
|
||||
return WcaFinalize(er);
|
||||
}
|
||||
|
||||
/*
|
||||
Check for valid data directory is empty during install
|
||||
A valid data directory is non-existing, or empty.
|
||||
|
|
|
@ -8,3 +8,4 @@ CheckDatabaseProperties
|
|||
CheckDataDirectory
|
||||
CheckDBInUse
|
||||
CheckServiceUpgrades
|
||||
CheckInstallDirectory
|
||||
|
|
|
@ -346,6 +346,7 @@
|
|||
|
||||
<Property Id="CRLF" Value="
" />
|
||||
<CustomAction Id="CheckDataDirectory" BinaryKey="wixca.dll" DllEntry="CheckDataDirectory" Execute="immediate" Impersonate="yes"/>
|
||||
<CustomAction Id="CheckInstallDirectory" BinaryKey="wixca.dll" DllEntry="CheckInstallDirectory" Execute="immediate" Impersonate="yes"/>
|
||||
<!-- What to do when navigation buttons are clicked -->
|
||||
<UI Id="MyWixUI_Mondo">
|
||||
<UIRef Id="WixUI_FeatureTree" />
|
||||
|
@ -365,6 +366,12 @@
|
|||
<Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="NewOrUpgradeInstanceDlg" Order="999">
|
||||
NOT Installed AND UpgradableServiceFound
|
||||
</Publish>
|
||||
<Publish Dialog="CustomizeDlg" Control="Next" Event="DoAction" Value="CheckInstallDirectory" Order="1">NOT Installed</Publish>
|
||||
<Publish Dialog="CustomizeDlg" Control="Next" Property="WarningText" Order="2"
|
||||
Value="[INSTALLDIRERROR]">
|
||||
INSTALLDIRERROR
|
||||
</Publish>
|
||||
<Publish Dialog="CustomizeDlg" Control="Next" Event="SpawnDialog" Value="WarningDlg" Order="3">WarningText</Publish>
|
||||
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="ConfirmDataCleanupDlg" Order="4">
|
||||
<![CDATA[(&DBInstance=2) AND (!DBInstance=3)]]>
|
||||
</Publish>
|
||||
|
@ -645,11 +652,17 @@
|
|||
|
||||
<CustomAction Id='ErrorDataDir'
|
||||
Error='Invalid data directory, choose a different one. Error : [DATADIRERROR]'/>
|
||||
<CustomAction Id="ErrorInstallDir"
|
||||
Error="[INSTALLDIRERROR]" />
|
||||
<InstallExecuteSequence>
|
||||
<Custom Action="CheckDataDirectory" After="CostFinalize">
|
||||
<![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND OLDERVERSIONBEINGUPGRADED=""]]>
|
||||
</Custom>
|
||||
<Custom Action="ErrorDataDir" After="CheckDataDirectory">DATADIRERROR</Custom>
|
||||
<Custom Action="ErrorDataDir" After="CheckDataDirectory">DATADIRERROR</Custom>
|
||||
<Custom Action="CheckInstallDirectory" After="CostFinalize">
|
||||
NOT Installed
|
||||
</Custom>
|
||||
<Custom Action="ErrorInstallDir" After="CheckInstallDirectory">INSTALLDIRERROR</Custom>
|
||||
<Custom Action="CheckDatabaseProperties" Before="CreateDatabaseCommand">SERVICENAME</Custom>
|
||||
<Custom Action="CreateDatabaseCommand" After="CostFinalize" >
|
||||
<![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND OLDERVERSIONBEINGUPGRADED=""]]>
|
||||
|
|
Loading…
Add table
Reference in a new issue