summaryrefslogtreecommitdiff
path: root/setup_native
diff options
context:
space:
mode:
authorJoachim Lingner <jl@openoffice.org>2010-07-14 09:23:58 +0200
committerJoachim Lingner <jl@openoffice.org>2010-07-14 09:23:58 +0200
commitc8505273af04f35d0ff69f2c38f098d77a18f0b7 (patch)
treeb82fa392f84a3d3de7a8b455043621052c0a8f02 /setup_native
parentecde3e0e683f5969e8a770c0ec0634459b257778 (diff)
jl154 #162868# windows custom action for running unopkg sync
Diffstat (limited to 'setup_native')
-rw-r--r--setup_native/source/win32/customactions/languagepacks/exports.dxp3
-rwxr-xr-xsetup_native/source/win32/customactions/patch/exports.dxp2
-rwxr-xr-xsetup_native/source/win32/customactions/patch/makefile.mk1
-rw-r--r--setup_native/source/win32/customactions/shellextensions/registerextensions.cxx196
4 files changed, 29 insertions, 173 deletions
diff --git a/setup_native/source/win32/customactions/languagepacks/exports.dxp b/setup_native/source/win32/customactions/languagepacks/exports.dxp
index 7461090d7233..c098a38d547f 100644
--- a/setup_native/source/win32/customactions/languagepacks/exports.dxp
+++ b/setup_native/source/win32/customactions/languagepacks/exports.dxp
@@ -3,5 +3,4 @@ RegisterLanguagePack
GetUserInstallMode
IsOfficeRunning
RegisterExtensions
-DeregisterExtensions
-RemoveExtensions
+
diff --git a/setup_native/source/win32/customactions/patch/exports.dxp b/setup_native/source/win32/customactions/patch/exports.dxp
index b57f2838bf34..dd5eb4dcf7c8 100755
--- a/setup_native/source/win32/customactions/patch/exports.dxp
+++ b/setup_native/source/win32/customactions/patch/exports.dxp
@@ -7,3 +7,5 @@ IsOfficeRunning
SetFeatureState
SetNewFeatureState
ShowOnlineUpdateDialog
+RegisterExtensions
+RemoveExtensions
diff --git a/setup_native/source/win32/customactions/patch/makefile.mk b/setup_native/source/win32/customactions/patch/makefile.mk
index cb8733de20b6..57705389248f 100755
--- a/setup_native/source/win32/customactions/patch/makefile.mk
+++ b/setup_native/source/win32/customactions/patch/makefile.mk
@@ -76,6 +76,7 @@ SHL1OBJS = $(SLOFILES) \
$(SLO)$/shutdown_quickstart.obj \
$(SLO)$/quickstarter.obj \
$(SLO)$/upgrade.obj \
+ $(SLO)$/registerextensions.obj \
$(SLO)$/seterror.obj
SHL1TARGET = $(TARGET)
diff --git a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
index 3906d2584fd1..001b99c02fa3 100644
--- a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
@@ -319,203 +319,57 @@ extern "C" UINT __stdcall RegisterExtensions(MSIHANDLE handle)
{
std::_tstring sInstDir = GetMsiProperty( handle, TEXT("INSTALLLOCATION") );
std::_tstring sUnoPkgFile = sInstDir + TEXT("program\\unopkg.exe");
- std::_tstring sShareInstallDir = sInstDir + TEXT("share\\extension\\install\\");
- std::_tstring sPattern = sShareInstallDir + TEXT("*.oxt");
std::_tstring mystr;
WIN32_FIND_DATA aFindFileData;
mystr = "unopkg file: " + sUnoPkgFile;
- // MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
-
- mystr = "oxt file directory: " + sShareInstallDir;
- // MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
+ MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
// Find unopkg.exe
-
HANDLE hFindUnopkg = FindFirstFile( sUnoPkgFile.c_str(), &aFindFileData );
if ( hFindUnopkg != INVALID_HANDLE_VALUE )
{
// unopkg.exe exists in program directory
- // Finding all oxt files in sShareInstallDir
-
- HANDLE hFindOxt = FindFirstFile( sPattern.c_str(), &aFindFileData );
-
- if ( hFindOxt != INVALID_HANDLE_VALUE )
- {
- bool fNextFile = false;
-
- do
- {
- const std::_tstring sTempFolder(createTempFolder());
- std::_tstring sOxtFile = sShareInstallDir + aFindFileData.cFileName;
- std::_tstring sCommandPart1 = sUnoPkgFile + " add --shared --suppress-license --bundled " + "\"" + sOxtFile + "\"";
- std::_tstring sCommand = sCommandPart1
- + TEXT(" -env:UNO_JAVA_JFW_INSTALL_DATA=$OOO_BASE_DIR/share/config/javasettingsunopkginstall.xml")
- + TEXT(" -env:UserInstallation=") + sTempFolder;
- mystr = "Command: " + sCommand;
- // MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
-
- DWORD exitCode = 0;
- bool fSuccess = ExecuteCommand( sCommand.c_str(), & exitCode);
- // unopkg in OOo 2.2.1 and early had a bug that it failed when receiving
- // a bootstrap parameter (-env:...) then it exited with a value != 0.
- if (fSuccess && exitCode != 0)
- {
- std::_tstring sCommand = sCommandPart1;
- mystr = "Command: " + sCommand;
- // MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
- fSuccess = ExecuteCommand( sCommand.c_str(), & exitCode);
- }
- deleteTempFolder(sTempFolder);
-
- // 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);
- // }
-
- fNextFile = FindNextFile( hFindOxt, &aFindFileData );
-
- } while ( fNextFile );
-
- FindClose( hFindOxt );
- }
- }
- // else
- // {
- // mystr = "Error: Did not find " + sUnoPkgFile;
- // MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
- // }
-
- return ERROR_SUCCESS;
-}
-
-extern "C" UINT __stdcall DeregisterExtensions(MSIHANDLE handle)
-{
- std::_tstring mystr;
-
- // Finding the product with the help of the propery FINDPRODUCT,
- // that contains a Windows Registry key, that points to the install location.
+ const std::_tstring sTempFolder(createTempFolder());
+ std::_tstring sCommandPart1 = sUnoPkgFile + " sync";
+ std::_tstring sCommand = sCommandPart1
+ + TEXT(" -env:BUNDLED_EXTENSIONS_USER=$OOO_BASE_DIR/presets/bundled")
+ + TEXT(" -env:UNO_JAVA_JFW_INSTALL_DATA=$OOO_BASE_DIR/share/config/javasettingsunopkginstall.xml")
+ + TEXT(" -env:UserInstallation=") + sTempFolder;
+ mystr = "Command: " + sCommand;
+ MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
- TCHAR szValue[8192];
- DWORD nValueSize = sizeof(szValue);
- HKEY hKey;
- std::_tstring sInstDir;
+ DWORD exitCode = 0;
+ bool fSuccess = ExecuteCommand( sCommand.c_str(), & exitCode);
- std::_tstring sProductKey = GetMsiProperty( handle, TEXT("FINDPRODUCT") );
- // MessageBox( NULL, sProductKey.c_str(), "Titel", MB_OK );
+ deleteTempFolder(sTempFolder);
- if ( ERROR_SUCCESS == RegOpenKey( HKEY_CURRENT_USER, sProductKey.c_str(), &hKey ) )
- {
- if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("INSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) )
+ if ( fSuccess )
{
- sInstDir = szValue;
+ mystr = "Executed successfully!";
+ MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
}
- RegCloseKey( hKey );
- }
- else if ( ERROR_SUCCESS == RegOpenKey( HKEY_LOCAL_MACHINE, sProductKey.c_str(), &hKey ) )
- {
- if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("INSTALLLOCATION"), NULL, NULL, (LPBYTE)szValue, &nValueSize ) )
+ else
{
- sInstDir = szValue;
+ mystr = "An error occured during execution!";
+ MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
}
- RegCloseKey( hKey );
+
+ FindClose( hFindUnopkg );
}
else
{
- return ERROR_SUCCESS;
+ mystr = "Error: Did not find " + sUnoPkgFile;
+ MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
}
- // MessageBox( NULL, sInstDir.c_str(), "install location", MB_OK );
-
- // Searching for the unopkg.exe
-
- std::_tstring sUnoPkgFile = sInstDir + TEXT("program\\unopkg.exe");
- std::_tstring sShareInstallDir = sInstDir + TEXT("share\\extension\\install\\");
- std::_tstring sPattern = sShareInstallDir + TEXT("*.oxt");
-
- WIN32_FIND_DATA aFindFileData;
-
- // Find unopkg.exe
-
- HANDLE hFindUnopkg = FindFirstFile( sUnoPkgFile.c_str(), &aFindFileData );
-
- if ( hFindUnopkg != INVALID_HANDLE_VALUE )
- {
- // unopkg.exe exists in program directory
-
- // Finding all oxt files in sShareInstallDir
-
- HANDLE hFindOxt = FindFirstFile( sPattern.c_str(), &aFindFileData );
-
- if ( hFindOxt != INVALID_HANDLE_VALUE )
- {
- bool fNextFile = false;
-
- do
- {
- const std::_tstring sTempFolder(createTempFolder());
- // When removing extensions, only the oxt file name is required, without path
- // Therefore no quoting is required
- // std::_tstring sOxtFile = sShareInstallDir + aFindFileData.cFileName;
- std::_tstring sOxtFile = aFindFileData.cFileName;
- std::_tstring sCommandPart1 = sUnoPkgFile + " remove --shared --bundled " + "\""
- + sOxtFile + "\"";
- std::_tstring sCommand = sCommandPart1
- + TEXT(" -env:UNO_JAVA_JFW_INSTALL_DATA=$OOO_BASE_DIR/share/config/javasettingsunopkginstall.xml")
- + TEXT(" -env:UserInstallation=") + sTempFolder;
-
- mystr = "Command: " + sCommand;
- //MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
- DWORD exitCode = 0;
- bool fSuccess = ExecuteCommand( sCommand.c_str(), & exitCode);
- // unopkg in OOo 2.2.1 and early had a bug that it failed when receiving
- // a bootstrap parameter (-env:...) then it exited with a value != 0.
- if (fSuccess && exitCode != 0)
- {
- std::_tstring sCommand = sCommandPart1;
- mystr = "Command: " + sCommand;
- //MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
- fSuccess = ExecuteCommand( sCommand.c_str(), & exitCode);
- }
-
- deleteTempFolder(sTempFolder);
-
- 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);
- }
-
- fNextFile = FindNextFile( hFindOxt, &aFindFileData );
-
- } while ( fNextFile );
-
- FindClose( hFindOxt );
- }
- }
- // else
- // {
- // mystr = "Not found: " + sUnoPkgFile;
- // MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
- // }
-
return ERROR_SUCCESS;
}
+
extern "C" UINT __stdcall RemoveExtensions(MSIHANDLE handle)
{
std::_tstring mystr;
@@ -552,9 +406,9 @@ extern "C" UINT __stdcall RemoveExtensions(MSIHANDLE handle)
return ERROR_SUCCESS;
}
- // Removing complete directory "share\uno_packages\cache"
+ // Removing complete directory "Basis\presets\bundled"
- std::_tstring sCacheDir = sInstDir + TEXT("share\\uno_packages\\cache");
+ std::_tstring sCacheDir = sInstDir + TEXT("Basis\\presets\\bundled");
bool fSuccess = RemoveCompleteDirectory( sCacheDir );