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