LibreOffice Module desktop (master) 1
unopkg_app.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20
21#include <dp_misc.h>
22#include "unopkg_main.h"
23#include "unopkg_shared.h"
24#include <dp_identifier.hxx>
26#include <rtl/bootstrap.hxx>
27#include <rtl/textenc.h>
28#include <rtl/ustring.hxx>
29#include <osl/process.h>
30#include <osl/conditn.hxx>
31#include <unotools/tempfile.hxx>
37#include <com/sun/star/deployment/DeploymentException.hpp>
38#include <com/sun/star/deployment/ExtensionManager.hpp>
39
40#include <com/sun/star/deployment/ui/PackageManagerDialog.hpp>
41#include <com/sun/star/lang/IllegalArgumentException.hpp>
42#include <com/sun/star/logging/ConsoleHandler.hpp>
43#include <com/sun/star/logging/FileHandler.hpp>
44#include <com/sun/star/logging/LogLevel.hpp>
45#include <com/sun/star/logging/SimpleTextFormatter.hpp>
46#include <com/sun/star/logging/XLogger.hpp>
47#include <com/sun/star/ucb/CommandAbortedException.hpp>
48#include <com/sun/star/ucb/CommandFailedException.hpp>
49#include <com/sun/star/ui/dialogs/XDialogClosedListener.hpp>
50#if defined(UNX)
51 #include <unistd.h>
52#endif
53#include <iostream>
54#include <utility>
55#include <vector>
56
57
58using namespace ::com::sun::star;
59using namespace ::com::sun::star::logging;
60using namespace ::com::sun::star::uno;
61using namespace ::unopkg;
62
63namespace {
64
65struct ExtensionName
66{
67 OUString m_str;
68 explicit ExtensionName( OUString str ) : m_str(std::move( str )) {}
69 bool operator () ( Reference<deployment::XPackage> const & e ) const
70 {
71 return m_str == dp_misc::getIdentifier(e)
72 || m_str == e->getName();
73 }
74};
75
76
77const char16_t s_usingText [] =
78u"\n"
79"using: " APP_NAME " add <options> extension-path...\n"
80" " APP_NAME " validate <options> extension-identifier...\n"
81" " APP_NAME " remove <options> extension-identifier...\n"
82" " APP_NAME " list <options> extension-identifier...\n"
83" " APP_NAME " reinstall <options>\n"
84" " APP_NAME " gui\n"
85" " APP_NAME " -V\n"
86" " APP_NAME " -h\n"
87"\n"
88"sub-commands:\n"
89" add add extension\n"
90" validate checks the prerequisites of an installed extension and\n"
91" registers it if possible\n"
92" remove remove extensions by identifier\n"
93" reinstall expert feature: reinstall all deployed extensions\n"
94" list list information about deployed extensions\n"
95" gui raise Extensions dialog\n"
96"\n"
97"options:\n"
98" -h, --help this help\n"
99" -V, --version version information\n"
100" -v, --verbose verbose output\n"
101" -f, --force force overwriting existing extensions\n"
102" -s, --suppress-license prevents showing the license\n"
103" --log-file <file> custom log file; default: <cache-dir>/log.txt\n"
104" --shared expert feature: operate on shared installation\n"
105" deployment context;\n"
106" run only when no concurrent Office\n"
107" process(es) are running!\n"
108" --bundled expert feature: operate on bundled extensions. Only\n"
109" works with list, validate, reinstall;\n"
110" --deployment-context expert feature: explicit deployment context\n"
111" <context>\n"
112"\n"
113"To learn more about extensions, see:\n"
114"https://wiki.documentfoundation.org/Documentation/DevGuide/Extensions\n\n";
115
116
117const OptionInfo s_option_infos [] = {
118 { RTL_CONSTASCII_STRINGPARAM("help"), 'h', false },
119 { RTL_CONSTASCII_STRINGPARAM("version"), 'V', false },
120 { RTL_CONSTASCII_STRINGPARAM("verbose"), 'v', false },
121 { RTL_CONSTASCII_STRINGPARAM("force"), 'f', false },
122 { RTL_CONSTASCII_STRINGPARAM("log-file"), '\0', true },
123 { RTL_CONSTASCII_STRINGPARAM("shared"), '\0', false },
124 { RTL_CONSTASCII_STRINGPARAM("deployment-context"), '\0', true },
125 { RTL_CONSTASCII_STRINGPARAM("bundled"), '\0', false},
126 { RTL_CONSTASCII_STRINGPARAM("suppress-license"), 's', false},
127
128 { nullptr, 0, '\0', false }
129};
130
131void logFatal(
132 comphelper::EventLogger const * logger, sal_Int32 level, OUString const & message,
133 OUString const & argument)
134{
135 if (logger == nullptr) {
136 // Best effort; potentially loses data due to conversion failures (stray surrogate halves)
137 // and embedded null characters:
138 std::cerr
139 << OUStringToOString(message.replaceFirst("$1$", argument), RTL_TEXTENCODING_UTF8)
140 << '\n';
141 } else {
142 logger->log(level, message, argument);
143 }
144}
145
146class DialogClosedListenerImpl :
147 public ::cppu::WeakImplHelper< ui::dialogs::XDialogClosedListener >
148{
149 osl::Condition & m_rDialogClosedCondition;
150
151public:
152 explicit DialogClosedListenerImpl( osl::Condition & rDialogClosedCondition )
153 : m_rDialogClosedCondition( rDialogClosedCondition ) {}
154
155 // XEventListener (base of XDialogClosedListener)
156 virtual void SAL_CALL disposing( lang::EventObject const & Source ) override;
157
158 // XDialogClosedListener
159 virtual void SAL_CALL dialogClosed(
160 ui::dialogs::DialogClosedEvent const & aEvent ) override;
161};
162
163// XEventListener (base of XDialogClosedListener)
164void DialogClosedListenerImpl::disposing( lang::EventObject const & )
165{
166 // nothing to do
167}
168
169// XDialogClosedListener
170void DialogClosedListenerImpl::dialogClosed(
171 ui::dialogs::DialogClosedEvent const & )
172{
173 m_rDialogClosedCondition.set();
174}
175
176// If a package had been installed with a pre OOo 2.2, it could not normally be
177// found via its identifier; similarly (and for ease of use), a package
178// installed with OOo 2.2 or later could not normally be found via its file
179// name.
180Reference<deployment::XPackage> findPackage(
181 OUString const & repository,
182 Reference<deployment::XExtensionManager> const & manager,
183 Reference<ucb::XCommandEnvironment > const & environment,
184 std::u16string_view idOrFileName )
185{
186 const Sequence< Reference<deployment::XPackage> > ps(
187 manager->getDeployedExtensions(repository,
188 Reference<task::XAbortChannel>(), environment ) );
189 for ( auto const & package : ps )
190 if ( dp_misc::getIdentifier( package ) == idOrFileName )
191 return package;
192 for ( auto const & package : ps )
193 if ( package->getName() == idOrFileName )
194 return package;
195 return Reference<deployment::XPackage>();
196}
197
198} // anon namespace
199
200extern "C" int unopkg_main()
201{
203 bool bShowFailedMsg = true;
204 OUString subCommand;
205 bool option_shared = false;
206 bool option_force = false;
207 bool option_verbose = false;
208 bool option_bundled = false;
209 bool option_suppressLicense = false;
210 bool option_help = false;
211 bool subcmd_gui = false;
212 OUString logFile;
213 OUString repository;
214 OUString cmdArg;
215 std::vector<OUString> cmdPackages;
216 Reference<XLogHandler> xFileHandler;
217 Reference<XLogHandler> xConsoleHandler;
218 std::unique_ptr<comphelper::EventLogger> logger;
219 std::unique_ptr<utl::TempFileNamed> pUserProfileTempDir;
220
221 OptionInfo const * info_shared = getOptionInfo(
222 s_option_infos, "shared" );
223 OptionInfo const * info_force = getOptionInfo(
224 s_option_infos, "force" );
225 OptionInfo const * info_verbose = getOptionInfo(
226 s_option_infos, "verbose" );
227 OptionInfo const * info_log = getOptionInfo(
228 s_option_infos, "log-file" );
229 OptionInfo const * info_context = getOptionInfo(
230 s_option_infos, "deployment-context" );
231 OptionInfo const * info_help = getOptionInfo(
232 s_option_infos, "help" );
233 OptionInfo const * info_version = getOptionInfo(
234 s_option_infos, "version" );
235 OptionInfo const * info_bundled = getOptionInfo(
236 s_option_infos, "bundled" );
237 OptionInfo const * info_suppressLicense = getOptionInfo(
238 s_option_infos, "suppress-license" );
239
240
241 Reference<XComponentContext> xComponentContext;
242 Reference<XComponentContext> xLocalComponentContext;
243
244 try {
245 sal_uInt32 nPos = 0;
246 sal_uInt32 nCount = osl_getCommandArgCount();
247 if (nCount == 0 || isOption( info_help, &nPos ))
248 {
249 dp_misc::writeConsole(s_usingText);
250 return 0;
251 }
252 else if (isOption( info_version, &nPos )) {
253 dp_misc::writeConsole(u"\n" APP_NAME " Version 3.3\n");
254 return 0;
255 }
256 //consume all bootstrap variables which may occur before the sub-command
258 ;
259
260 if(nPos >= nCount)
261 return 0;
262 //get the sub-command
263 osl_getCommandArg( nPos, &subCommand.pData );
264 ++nPos;
265 subCommand = subCommand.trim();
266 bool subcmd_add = subCommand == "add";
267 subcmd_gui = subCommand == "gui";
268
269 // sub-command options and packages:
270 while (nPos < nCount)
271 {
272 if (readArgument( &cmdArg, info_log, &nPos )) {
273 logFile = makeAbsoluteFileUrl(
274 cmdArg.trim(), getProcessWorkingDir() );
275 }
276 else if (!readOption( &option_verbose, info_verbose, &nPos ) &&
277 !readOption( &option_shared, info_shared, &nPos ) &&
278 !readOption( &option_force, info_force, &nPos ) &&
279 !readOption( &option_bundled, info_bundled, &nPos ) &&
280 !readOption( &option_suppressLicense, info_suppressLicense, &nPos ) &&
281 !readOption( &option_help, info_help, &nPos ) &&
282 !readArgument( &repository, info_context, &nPos ) &&
284 {
285 osl_getCommandArg( nPos, &cmdArg.pData );
286 ++nPos;
287 cmdArg = cmdArg.trim();
288 if (!cmdArg.isEmpty())
289 {
290 if (cmdArg[ 0 ] == '-')
291 {
292 // is option:
293 dp_misc::writeConsoleError(Concat2View(
294 "\nERROR: unexpected option " +
295 cmdArg +
296 "!\n Use " APP_NAME " " +
297 toString(info_help) +
298 " to print all options.\n"));
299 return 1;
300 }
301 else
302 {
303 // is package:
304 cmdPackages.push_back(
305 subcmd_add || subcmd_gui
307 cmdArg, getProcessWorkingDir() )
308 : cmdArg );
309 }
310 }
311 }
312 }
313
314 // tdf#129917 Use temp user profile when installing shared extensions
315 if (option_shared)
316 {
317 pUserProfileTempDir.reset(new utl::TempFileNamed(nullptr, true));
318 pUserProfileTempDir->EnableKillingFile();
319 }
320
321 xComponentContext = getUNO(option_verbose, subcmd_gui,
322 pUserProfileTempDir ? pUserProfileTempDir->GetURL() : "",
323 xLocalComponentContext);
324
325 // Initialize logging. This will log errors to the console and
326 // also to file if the --log-file parameter was provided.
327 logger.reset(new comphelper::EventLogger(xLocalComponentContext, "unopkg"));
328 const Reference<XLogger> xLogger(logger->getLogger());
329 xLogger->setLevel(LogLevel::WARNING);
330 Reference<XLogFormatter> xLogFormatter(SimpleTextFormatter::create(xLocalComponentContext));
331 Sequence < beans::NamedValue > aSeq { { "Formatter", Any(xLogFormatter) } };
332
333 xConsoleHandler.set(ConsoleHandler::createWithSettings(xLocalComponentContext, aSeq));
334 xLogger->addLogHandler(xConsoleHandler);
335 xConsoleHandler->setLevel(LogLevel::WARNING);
336 xLogger->setLevel(LogLevel::WARNING);
337
338
339 if (!logFile.isEmpty())
340 {
341 Sequence < beans::NamedValue > aSeq2 { { "Formatter", Any(xLogFormatter) }, {"FileURL", Any(logFile)} };
342 xFileHandler.set(css::logging::FileHandler::createWithSettings(xLocalComponentContext, aSeq2));
343 xFileHandler->setLevel(LogLevel::WARNING);
344 xLogger->addLogHandler(xFileHandler);
345 }
346
347 if (option_verbose)
348 {
349 xLogger->setLevel(LogLevel::INFO);
350 xConsoleHandler->setLevel(LogLevel::INFO);
351 if (xFileHandler.is())
352 xFileHandler->setLevel(LogLevel::INFO);
353 }
354
355 if (repository.isEmpty())
356 {
357 if (option_shared)
358 repository = "shared";
359 else if (option_bundled)
360 repository = "bundled";
361 else
362 repository = "user";
363 }
364 else
365 {
366 if ( repository == "shared" ) {
367 option_shared = true;
368 }
369 else if (option_shared)
370 {
371 logger->log(LogLevel::WARNING, "Explicit context given! Ignoring option '$1$'", toString(info_shared));
372 }
373 }
374#if defined(UNX)
375 if ( geteuid() == 0 )
376 {
377 if ( !(option_shared || option_bundled || option_help) )
378 {
379 logger->log(LogLevel::SEVERE, "Cannot run $1$ as root without $2$ or $3$ option.",
380 APP_NAME, toString(info_shared), toString(info_bundled));
381 return 1;
382 }
383 }
384#endif
385
386 if (subCommand == "reinstall")
387 {
388 //We must prevent that services and types are loaded by UNO,
389 //otherwise we cannot delete the registry data folder.
390 OUString extensionUnorc;
391 if (repository == "user")
392 extensionUnorc = "$UNO_USER_PACKAGES_CACHE/registry/com.sun.star.comp.deployment.component.PackageRegistryBackend/unorc";
393 else if (repository == "shared")
394 extensionUnorc = "$SHARED_EXTENSIONS_USER/registry/com.sun.star.comp.deployment.component.PackageRegistryBackend/unorc";
395 else if (repository == "bundled")
396 extensionUnorc = "$BUNDLED_EXTENSIONS_USER/registry/com.sun.star.comp.deployment.component.PackageRegistryBackend/unorc";
397 else
398 OSL_ASSERT(false);
399
400 ::rtl::Bootstrap::expandMacros(extensionUnorc);
401 oslFileError e = osl_removeFile(extensionUnorc.pData);
402 if (e != osl_File_E_None && e != osl_File_E_NOENT)
403 throw Exception("Could not delete " + extensionUnorc, nullptr);
404 }
405
406 Reference<deployment::XExtensionManager> xExtensionManager(
407 deployment::ExtensionManager::get( xComponentContext ) );
408
409 Reference<css::ucb::XCommandEnvironment> xCmdEnv(
410 createCmdEnv(xComponentContext, option_force, option_verbose, option_suppressLicense));
411
412 //synchronize bundled/shared extensions
413 //Do not synchronize when command is "reinstall". This could add types and services to UNO and
414 //prevent the deletion of the registry data folder
415 //syncing is done in XExtensionManager.reinstall
416 if (!subcmd_gui && subCommand != "reinstall"
418 dp_misc::syncRepositories(false, xCmdEnv);
419
420 if ( subcmd_add || subCommand == "remove" )
421 {
422 for (const OUString & cmdPackage : cmdPackages)
423 {
424 if (subcmd_add)
425 {
426 beans::NamedValue nvSuppress(
427 "SUPPRESS_LICENSE", option_suppressLicense ?
428 Any(OUString("1")):Any(OUString("0")));
429 xExtensionManager->addExtension(
430 cmdPackage, Sequence<beans::NamedValue>(&nvSuppress, 1),
431 repository, Reference<task::XAbortChannel>(), xCmdEnv);
432 }
433 else
434 {
435 try
436 {
437 xExtensionManager->removeExtension(
438 cmdPackage, cmdPackage, repository,
439 Reference<task::XAbortChannel>(), xCmdEnv );
440 }
441 catch (const lang::IllegalArgumentException &)
442 {
443 Reference<deployment::XPackage> p(
444 findPackage(repository,
445 xExtensionManager, xCmdEnv, cmdPackage ) );
446 if ( !p.is())
447 throw;
448 else if (p.is())
449 xExtensionManager->removeExtension(
450 ::dp_misc::getIdentifier(p), p->getName(),
451 repository,
452 Reference<task::XAbortChannel>(), xCmdEnv );
453 }
454 }
455 }
456 }
457 else if ( subCommand == "reinstall" )
458 {
459 xExtensionManager->reinstallDeployedExtensions(
460 false, repository, Reference<task::XAbortChannel>(), xCmdEnv);
461 }
462 else if ( subCommand == "list" )
463 {
464 std::vector<Reference<deployment::XPackage> > vecExtUnaccepted;
465 ::comphelper::sequenceToContainer(vecExtUnaccepted,
466 xExtensionManager->getExtensionsWithUnacceptedLicenses(
467 repository, xCmdEnv));
468
469 //This vector tells what XPackage in allExtensions has an
470 //unaccepted license.
471 std::vector<bool> vecUnaccepted;
472 std::vector<Reference<deployment::XPackage> > allExtensions;
473 if (cmdPackages.empty())
474 {
475 Sequence< Reference<deployment::XPackage> >
476 packages = xExtensionManager->getDeployedExtensions(
477 repository, Reference<task::XAbortChannel>(), xCmdEnv );
478
479 std::vector<Reference<deployment::XPackage> > vec_packages;
480 ::comphelper::sequenceToContainer(vec_packages, packages);
481
482 //First copy the extensions with the unaccepted license
483 //to vector allExtensions.
484 allExtensions.resize(vecExtUnaccepted.size() + vec_packages.size());
485
486 std::vector<Reference<deployment::XPackage> >::iterator i_all_ext =
487 std::copy(vecExtUnaccepted.begin(), vecExtUnaccepted.end(),
488 allExtensions.begin());
489 //Now copy those we got from getDeployedExtensions
490 std::copy(vec_packages.begin(), vec_packages.end(), i_all_ext);
491
492 //Now prepare the vector which tells what extension has an
493 //unaccepted license
494 vecUnaccepted.resize(vecExtUnaccepted.size() + vec_packages.size());
495 std::fill_n(vecUnaccepted.begin(), vecExtUnaccepted.size(), true);
496 std::fill_n(vecUnaccepted.begin() + vecExtUnaccepted.size(),
497 vec_packages.size(), false);
498
500 Concat2View("All deployed " + repository + " extensions:\n\n"));
501 }
502 else
503 {
504 //The user provided the names (ids or file names) of the extensions
505 //which shall be listed
506 for (const OUString & cmdPackage : cmdPackages)
507 {
508 Reference<deployment::XPackage> extension;
509 try
510 {
511 extension = xExtensionManager->getDeployedExtension(
512 repository, cmdPackage, cmdPackage, xCmdEnv );
513 }
514 catch (const lang::IllegalArgumentException &)
515 {
516 extension = findPackage(repository,
517 xExtensionManager, xCmdEnv, cmdPackage );
518 }
519
520 //Now look if the requested extension has an unaccepted license
521 bool bUnacceptedLic = false;
522 if (!extension.is())
523 {
524 std::vector<Reference<deployment::XPackage> >::const_iterator
525 i = std::find_if(
526 vecExtUnaccepted.begin(),
527 vecExtUnaccepted.end(), ExtensionName(cmdPackage));
528 if (i != vecExtUnaccepted.end())
529 {
530 extension = *i;
531 bUnacceptedLic = true;
532 }
533 }
534
535 if (!extension.is())
536 throw lang::IllegalArgumentException(
537 "There is no such extension deployed: " +
538 cmdPackage,nullptr,-1);
539 allExtensions.push_back(extension);
540 vecUnaccepted.push_back(bUnacceptedLic);
541 }
542
543 }
544
545 printf_packages(allExtensions, vecUnaccepted, xCmdEnv );
546 }
547 else if ( subCommand == "validate" )
548 {
549 std::vector<Reference<deployment::XPackage> > vecExtUnaccepted;
550 ::comphelper::sequenceToContainer(
551 vecExtUnaccepted, xExtensionManager->getExtensionsWithUnacceptedLicenses(
552 repository, xCmdEnv));
553
554 for (const OUString & cmdPackage : cmdPackages)
555 {
556 Reference<deployment::XPackage> extension;
557 try
558 {
559 extension = xExtensionManager->getDeployedExtension(
560 repository, cmdPackage, cmdPackage, xCmdEnv );
561 }
562 catch (const lang::IllegalArgumentException &)
563 {
564 extension = findPackage(
565 repository, xExtensionManager, xCmdEnv, cmdPackage );
566 }
567
568 if (!extension.is())
569 {
570 std::vector<Reference<deployment::XPackage> >::const_iterator
571 i = std::find_if(
572 vecExtUnaccepted.begin(),
573 vecExtUnaccepted.end(), ExtensionName(cmdPackage));
574 if (i != vecExtUnaccepted.end())
575 {
576 extension = *i;
577 }
578 }
579
580 if (extension.is())
581 xExtensionManager->checkPrerequisitesAndEnable(
582 extension, Reference<task::XAbortChannel>(), xCmdEnv);
583 }
584 }
585 else if ( subCommand == "gui" )
586 {
587 Reference<ui::dialogs::XAsynchronousExecutableDialog> xDialog(
588 deployment::ui::PackageManagerDialog::createAndInstall(
589 xComponentContext,
590 !cmdPackages.empty() ? cmdPackages[0] : OUString() ));
591
592 osl::Condition dialogEnded;
593 dialogEnded.reset();
594
595 Reference< ui::dialogs::XDialogClosedListener > xListener(
596 new DialogClosedListenerImpl( dialogEnded ) );
597
598 xDialog->startExecuteModal(xListener);
599 dialogEnded.wait();
600 return 0;
601 }
602 else
603 {
604 logger->log(LogLevel::SEVERE,
605 "Unknown sub-command: '$1$'. Use $2$ $3$ to print all options.",
606 subCommand, APP_NAME, toString(info_help));
607 return 1;
608 }
609
610 logger->log(LogLevel::INFO, "$1$ done.", APP_NAME);
611 //Force to release all bridges which connect us to the child processes
612 dp_misc::disposeBridges(xLocalComponentContext);
613 css::uno::Reference<css::lang::XComponent>(
614 xLocalComponentContext, css::uno::UNO_QUERY_THROW)->dispose();
615 return 0;
616 }
617 catch (const ucb::CommandFailedException &e)
618 {
619 logFatal(logger.get(), LogLevel::SEVERE, "Exception occurred: $1$", e.Message);
620 }
621 catch (const ucb::CommandAbortedException &)
622 {
623 logFatal(logger.get(), LogLevel::SEVERE, "$1$ aborted.", APP_NAME);
624 bShowFailedMsg = false;
625 }
626 catch (const deployment::DeploymentException & exc)
627 {
628 logFatal(logger.get(), LogLevel::SEVERE, "Exception occurred: $1$", exc.Message);
629 logFatal(
630 logger.get(), LogLevel::INFO, " Cause: $1$", comphelper::anyToString(exc.Cause));
631 }
632 catch (const LockFileException & e)
633 {
634 // No logger since it requires UNO which we don't have here
635 dp_misc::writeConsoleError(Concat2View(e.Message + "\n"));
636 bShowFailedMsg = false;
637 }
638 catch (const css::uno::Exception & e ) {
639 Any exc( ::cppu::getCaughtException() );
640
641 logFatal(logger.get(), LogLevel::SEVERE, "Exception occurred: $1$", e.Message);
642 logFatal(logger.get(), LogLevel::INFO, " Cause: $1$", comphelper::anyToString(exc));
643 }
644 if (bShowFailedMsg)
645 logFatal(logger.get(), LogLevel::SEVERE, "$1$ failed.", APP_NAME);
646 dp_misc::disposeBridges(xLocalComponentContext);
647 if (xLocalComponentContext.is()) {
648 css::uno::Reference<css::lang::XComponent>(
649 xLocalComponentContext, css::uno::UNO_QUERY_THROW)->dispose();
650 }
651 return 1;
652}
653
654
655/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void log(const sal_Int32 _nLogLevel, const OUString &rMessage) const
rtl::Reference< ParseManager > manager
int nCount
OUString m_str
Definition: dp_manager.cxx:88
float u
void * p
sal_uInt16 nPos
Sequence< sal_Int8 > aSeq
@ Exception
OUString anyToString(uno::Any const &value)
void syncRepositories(bool force, Reference< ucb::XCommandEnvironment > const &xCmdEnv)
Definition: dp_misc.cxx:492
void writeConsoleError(std::u16string_view sText)
writes the argument to the console using the error stream.
Definition: dp_misc.cxx:469
bool office_is_running()
Definition: dp_misc.cxx:332
void writeConsole(std::u16string_view sText)
writes the argument string to the console.
Definition: dp_misc.cxx:464
DESKTOP_DEPLOYMENTMISC_DLLPUBLIC OUString getIdentifier(css::uno::Reference< css::deployment::XPackage > const &package)
Gets the identifier of a package.
void disposeBridges(Reference< css::uno::XComponentContext > const &ctx)
Definition: dp_misc.cxx:531
css::uno::Reference< css::deployment::XPackageRegistry > create(css::uno::Reference< css::deployment::XPackageRegistry > const &xRootRegistry, OUString const &context, OUString const &cachePath, css::uno::Reference< css::uno::XComponentContext > const &xComponentContext)
int i
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
void extendApplicationEnvironment()
Reference< XCommandEnvironment > createCmdEnv(Reference< XComponentContext > const &xContext, bool option_force_overwrite, bool option_verbose, bool option_suppress_license)
Reference< XComponentContext > getUNO(bool verbose, bool bGui, const OUString &sTempDir, Reference< XComponentContext > &out_localContext)
OUString toString(OptionInfo const *info)
Definition: unopkg_misc.cxx:55
bool isOption(OptionInfo const *option_info, sal_uInt32 *pIndex)
Definition: unopkg_misc.cxx:94
bool readOption(bool *flag, OptionInfo const *option_info, sal_uInt32 *pIndex)
Definition: unopkg_shared.h:66
OUString const & getProcessWorkingDir()
bool readArgument(OUString *pValue, OptionInfo const *option_info, sal_uInt32 *pIndex)
void printf_packages(std::vector< Reference< deployment::XPackage > > const &allExtensions, std::vector< bool > const &vecUnaccepted, Reference< XCommandEnvironment > const &xCmdEnv, sal_Int32 level)
bool isBootstrapVariable(sal_uInt32 *pIndex)
checks if an argument is a bootstrap variable.
OptionInfo const * getOptionInfo(OptionInfo const *list, OUString const &opt)
Definition: unopkg_misc.cxx:73
OUString makeAbsoluteFileUrl(OUString const &sys_path, OUString const &base_url)
int unopkg_main()
Definition: unopkg_app.cxx:200
#define APP_NAME
Definition: unopkg_shared.h:29