diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2020-01-20 11:12:12 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2020-02-03 10:16:14 +0100 |
commit | c51a43bd70aa9fec0a051e51622a6a91f5aaa1a9 (patch) | |
tree | b4c0d42815477f45aa7389f5ff1d7422ea48a3c9 /desktop | |
parent | b16faa4dcd87b9c7203b230a9feaebbb05c5a9cb (diff) |
tdf#129917 Use temp user profile when installing shared extensions
Change-Id: I62dd163758e6348a62fc8a0b25150a62f282de90
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86543
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/pkgchk/unopkg/unopkg_app.cxx | 15 | ||||
-rw-r--r-- | desktop/source/pkgchk/unopkg/unopkg_misc.cxx | 7 | ||||
-rw-r--r-- | desktop/source/pkgchk/unopkg/unopkg_shared.h | 2 |
3 files changed, 16 insertions, 8 deletions
diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx index 97abd4c9dbc0..8532366885c0 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx @@ -26,6 +26,7 @@ #include <rtl/bootstrap.hxx> #include <osl/process.h> #include <osl/conditn.hxx> +#include <unotools/tempfile.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/exc_hlp.hxx> #include <comphelper/anytostring.hxx> @@ -196,6 +197,7 @@ extern "C" int unopkg_main() Reference<XLogHandler> xFileHandler; Reference<XLogHandler> xConsoleHandler; std::unique_ptr<comphelper::EventLogger> logger; + std::unique_ptr<utl::TempFile> pUserProfileTempDir; OptionInfo const * info_shared = getOptionInfo( s_option_infos, "shared" ); @@ -290,8 +292,16 @@ extern "C" int unopkg_main() } } - xComponentContext = getUNO( - option_verbose, option_shared, subcmd_gui, xLocalComponentContext ); + // tdf#129917 Use temp user profile when installing shared extensions + if (option_shared) + { + pUserProfileTempDir.reset(new utl::TempFile(nullptr, true)); + pUserProfileTempDir->EnableKillingFile(); + } + + xComponentContext = getUNO(option_verbose, subcmd_gui, + pUserProfileTempDir ? pUserProfileTempDir->GetURL() : "", + xLocalComponentContext); // Initialize logging. This will log errors to the console and // also to file if the --log-file parameter was provided. @@ -351,7 +361,6 @@ extern "C" int unopkg_main() APP_NAME, toString(info_shared), toString(info_bundled)); return 1; } - } #endif diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx index 50b6c58d9190..df276342b765 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx @@ -407,13 +407,12 @@ static OUString getLockFilePath() } Reference<XComponentContext> getUNO( - bool verbose, bool shared, bool bGui, + bool verbose, bool bGui, const OUString& sTempDir, Reference<XComponentContext> & out_localContext) { // do not create any user data (for the root user) in --shared mode: - if (shared) { - rtl::Bootstrap::set("CFG_CacheUrl", OUString()); - } + if (!sTempDir.isEmpty()) + rtl::Bootstrap::set("UserInstallation", sTempDir); // hold lock during process runtime: static ::desktop::Lockfile s_lockfile( false /* no IPC server */ ); diff --git a/desktop/source/pkgchk/unopkg/unopkg_shared.h b/desktop/source/pkgchk/unopkg/unopkg_shared.h index 04062a107e80..f86b3248c0d5 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_shared.h +++ b/desktop/source/pkgchk/unopkg/unopkg_shared.h @@ -107,7 +107,7 @@ void printf_packages( css::uno::Reference<css::uno::XComponentContext> getUNO( - bool verbose, bool shared, bool bGui, + bool verbose, bool bGui, const OUString& sTempDir, css::uno::Reference<css::uno::XComponentContext> & out_LocalComponentContext); } |