diff options
author | Ingo Schmidt <is@openoffice.org> | 2011-02-08 10:57:27 +0100 |
---|---|---|
committer | Ingo Schmidt <is@openoffice.org> | 2011-02-08 10:57:27 +0100 |
commit | 76df3c1d4649e26dab420a03853fdcc16a7aee48 (patch) | |
tree | 8e90d84947586193d06c8e5d41fcc3e5230845f3 /setup_native | |
parent | 143e8326931e0751caf3428eec0d8542229dd063 (diff) |
native361: #i115269# rollback of installation, if unopkg fails
Diffstat (limited to 'setup_native')
-rwxr-xr-x | setup_native/source/packinfo/shellscripts_extensions.txt | 24 | ||||
-rw-r--r-- | setup_native/source/win32/customactions/shellextensions/registerextensions.cxx | 55 |
2 files changed, 57 insertions, 22 deletions
diff --git a/setup_native/source/packinfo/shellscripts_extensions.txt b/setup_native/source/packinfo/shellscripts_extensions.txt index 0be870990b71..3ab47f925802 100755 --- a/setup_native/source/packinfo/shellscripts_extensions.txt +++ b/setup_native/source/packinfo/shellscripts_extensions.txt @@ -76,6 +76,12 @@ END if [ -x "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" ]; then "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" sync + if [ "$$?" != "0" ]; then + echo "ERROR: Registration of extensions failed!" + exit 1 + else + echo "SUCCESS: unopkg returns successful!" + fi find "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \; fi @@ -87,6 +93,12 @@ END if [ -x "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" ]; then "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" sync + if [ "$$?" != "0" ]; then + echo "ERROR: Registration of extensions failed!" + exit 1 + else + echo "SUCCESS: unopkg returns successful!" + fi find "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \; fi @@ -99,6 +111,12 @@ END if [ -x "PRODUCTDIRECTORYNAME/program/unopkg" ]; then "PRODUCTDIRECTORYNAME/program/unopkg" sync + if [ "$$?" != "0" ]; then + echo "ERROR: Registration of extensions failed!" + exit 1 + else + echo "SUCCESS: unopkg returns successful!" + fi find "PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \; fi @@ -111,6 +129,12 @@ END if [ -x "PRODUCTDIRECTORYNAME/program/unopkg" ] then "PRODUCTDIRECTORYNAME/program/unopkg" sync + if [ "$$?" != "0" ]; then + echo "ERROR: Registration of extensions failed!" + exit 1 + else + echo "SUCCESS: unopkg returns successful!" + fi find "PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \; fi diff --git a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx index 9a748e9f2008..4a44b360fdba 100644 --- a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx +++ b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx @@ -317,14 +317,13 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath ) extern "C" UINT __stdcall RegisterExtensions(MSIHANDLE handle) { - std::_tstring sInstDir = GetMsiProperty( handle, TEXT("INSTALLLOCATION") ); + // std::_tstring sInstDir = GetMsiProperty( handle, TEXT("INSTALLLOCATION") ); + std::_tstring sInstDir = GetMsiProperty( handle, TEXT("CustomActionData") ); std::_tstring sUnoPkgFile = sInstDir + TEXT("program\\unopkg.exe"); std::_tstring mystr; WIN32_FIND_DATA aFindFileData; - - mystr = "unopkg file: " + sUnoPkgFile; - //MessageBox(NULL, mystr.c_str(), "Command", MB_OK); + bool registrationError = false; // Find unopkg.exe HANDLE hFindUnopkg = FindFirstFile( sUnoPkgFile.c_str(), &aFindFileData ); @@ -333,32 +332,44 @@ extern "C" UINT __stdcall RegisterExtensions(MSIHANDLE handle) { // unopkg.exe exists in program directory std::_tstring sCommand = sUnoPkgFile + " sync"; - mystr = "Command: " + sCommand; - //MessageBox(NULL, mystr.c_str(), "Command", MB_OK); DWORD exitCode = 0; bool fSuccess = ExecuteCommand( sCommand.c_str(), & exitCode); -// if ( fSuccess ) -// { -// mystr = "Executed successfully!"; -// MessageBox(NULL, mystr.c_str(), "Command", MB_OK); -// } -// else -// { -// mystr = "An error occured during execution!"; -// MessageBox(NULL, mystr.c_str(), "Command", MB_OK); -// } +// if ( fSuccess ) +// { +// mystr = "Executed successfully!"; +// MessageBox(NULL, mystr.c_str(), "Command", MB_OK); +// } +// else +// { +// mystr = "An error occured during execution!"; +// MessageBox(NULL, mystr.c_str(), "Command", MB_OK); +// } + + if ( ! fSuccess ) + { + mystr = "ERROR: An error occured during registration of extensions!"; + MessageBox(NULL, mystr.c_str(), "ERROR", MB_OK); + registrationError = true; + } FindClose( hFindUnopkg ); } -// else -// { -// mystr = "Error: Did not find " + sUnoPkgFile; -// MessageBox(NULL, mystr.c_str(), "Command", MB_OK); -// } + // else + // { + // mystr = "Error: Did not find " + sUnoPkgFile; + // MessageBox(NULL, mystr.c_str(), "Command", MB_OK); + // } - return ERROR_SUCCESS; + if ( registrationError ) + { + return 1; + } + else + { + return ERROR_SUCCESS; + } } |