2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 /* @file wrt_installer.cpp
18 * @brief Implementation file for installer
21 #include "wrt_installer.h"
22 #include "plugin_utils.h"
28 #include <sys/resource.h>
29 #include <dpl/optional.h>
30 #include <dpl/scoped_free.h>
31 #include <dpl/optional_typedefs.h>
32 #include <dpl/exception.h>
33 #include <dpl/sstream.h>
35 #include <dpl/wrt-dao-ro/global_config.h>
36 #include <dpl/wrt-dao-ro/config_parser_data.h>
37 #include <dpl/localization/localization_utils.h>
38 #include <dpl/popup/popup_controller.h>
39 #include <dpl/optional_typedefs.h>
40 #include <dpl/string.h>
41 #include <dpl/abstract_waitable_input_adapter.h>
42 #include <dpl/abstract_waitable_output_adapter.h>
43 #include <dpl/zip_input.h>
44 #include <dpl/scoped_ptr.h>
45 #include <dpl/binary_queue.h>
47 #include <dpl/utils/wrt_global_settings.h>
48 #include "option_parser.h"
49 #include <parser_runner.h>
50 #include <widget_parser.h>
51 #include <root_parser.h>
52 //#include <pkg-manager/pkgmgr_signal.h>
54 #define NOFILE_CNT_FOR_INSTALLER 9999
56 using namespace WrtDB;
58 namespace { // anonymous
59 const char AUL_ARG_KEY[] = "widget_arg";
60 const char * const PKGMGR_INSTALL_MSG = "Install widget";
61 const char * const PKGMGR_UNINSTALL_MSG = "Uninstall widget";
63 const double BASE_LAYOUT_W = 720.0f;
64 const double BASE_LAYOUT_H = 1280.0f;
66 const char * const CONFIG_XML = "config.xml";
68 struct PluginInstallerData
71 std::string pluginPath;
73 } // namespace anonymous
75 WrtInstaller::WrtInstaller(int argc, char **argv) :
76 Application(argc, argv, "backend", false),
77 DPL::TaskDecl<WrtInstaller>(this),
81 m_numPluginsToInstall(0),
84 // m_installByPkgmgr(false),
87 m_startupPluginInstallation(false)
90 LogDebug("App Created");
93 WrtInstaller::~WrtInstaller()
95 LogDebug("App Finished");
98 void WrtInstaller::OnStop()
100 LogInfo("Stopping Dummy Client");
103 void WrtInstaller::OnCreate()
105 LogInfo("Creating DummyClient");
107 AddStep(&WrtInstaller::initStep);
109 std::string arg = m_argv[0];
112 return showHelpAndQuit();
117 if (arg.find("wrt-installer") != std::string::npos)
120 return showHelpAndQuit();
124 if (arg == "-h" || arg == "--help") {
126 return showHelpAndQuit();
130 return showHelpAndQuit();
131 } else if (arg == "-p" || arg == "--install-plugins") {
133 return showHelpAndQuit();
135 if (!m_startupPluginInstallation) {
136 AddStep(&WrtInstaller::installPluginsStep);
138 LogInfo("Plugin installation alredy started");
143 LogError("Unknown option");
144 return showHelpAndQuit();
148 AddStep(&WrtInstaller::shutdownStep);
149 DPL::Event::ControllerEventHandler<
150 WRTInstallerNS::NextStepEvent>::PostEvent(
151 WRTInstallerNS::NextStepEvent());
154 //void WrtInstaller::OnReset(bundle *b)
156 // const char * bundledVal = bundle_get_val(b, AUL_ARG_KEY);
157 // if (bundledVal != NULL) {
158 // m_bundleValue = bundledVal;
159 // LogInfo("Bundled value for (" << AUL_ARG_KEY << ") key received: " <<
164 int WrtInstaller::getReturnStatus() const
166 if (!m_returnStatus) {
173 void WrtInstaller::OnTerminate()
175 LogDebug("Wrt Shutdown now");
176 PluginUtils::unlockPluginInstallation();
178 wrt_installer_shutdown();
183 void WrtInstaller::showHelpAndQuit()
185 printf("Usage: wrt-installer [OPTION]... [WIDGET: ID/NAME/GUID/PATH]...\n"
186 "Operate with WebRuntime daemon: install, uninstall"
187 " and launch widgets.\n"
188 "Query list of installed widgets and setup up debugging support.\n"
190 "Exactly one option must be selected.\n"
191 "Mandatory arguments to long options are mandatory for short "
193 " -h, --help show this help\n"
194 " -p, --install-plugins install plugins\n"
200 void WrtInstaller::OnEventReceived(const WRTInstallerNS::QuitEvent& /*event*/)
205 LogDebug("Wrt Shutdown now");
206 SwitchToStep(&WrtInstaller::shutdownStep);
207 DPL::Event::ControllerEventHandler<WRTInstallerNS::NextStepEvent>::PostEvent(
208 WRTInstallerNS::NextStepEvent());
210 LogDebug("Quiting application");
215 void WrtInstaller::OnEventReceived(
216 const WRTInstallerNS::NextStepEvent& /*event*/)
218 LogDebug("Executing next step");
222 void WrtInstaller::OnEventReceived(
223 const WRTInstallerNS::InstallPluginEvent& /*event*/)
225 PluginInstallerData* privateData = new PluginInstallerData;
226 privateData->wrtInstaller = this;
228 if (!(*m_pluginsPaths).empty()) {
229 privateData->pluginPath = (*m_pluginsPaths).front();
230 (*m_pluginsPaths).pop_front();
232 wrt_install_plugin(privateData->pluginPath.c_str(),
233 static_cast<void*>(privateData),
234 &staticWrtPluginInstallationCallback,
235 &staticWrtPluginInstallProgressCb);
241 void WrtInstaller::initStep()
243 wrt_installer_init(this, staticWrtInitCallback);
246 //void WrtInstaller::installStep()
248 // LogDebug("Installing widget ...");
249 // DPL::ScopedFree<char> packagePath(canonicalize_file_name(
250 // m_packagePath.c_str()));
252 // wrt_install_widget(packagePath ? packagePath.Get() : m_packagePath.c_str(),
253 // this, &staticWrtStatusCallback,
254 // (!m_quiet || m_installByPkgmgr)
255 // ? &staticWrtInstallProgressCallback : NULL,
260 void WrtInstaller::installPluginsStep()
262 LogDebug("Installing plugins ...");
264 if (m_startupPluginInstallation) {
265 LogInfo("Plugin installation started because new plugin package found");
266 } else if (!PluginUtils::lockPluginInstallation()) {
267 LogError("Failed to open plugin installation lock file"
268 " Plugins are currently installed by other process");
269 staticWrtPluginInstallationCallback(WRT_PLUGIN_INSTALLER_ERROR_LOCK,
274 std::string PLUGIN_PATH = std::string(GlobalConfig::GetDevicePluginPath());
277 dir = opendir(PLUGIN_PATH.c_str());
283 LogInfo("Plugin DIRECTORY IS" << PLUGIN_PATH);
284 struct dirent* libdir;
288 std::list<std::string> pluginsPaths;
290 while ((libdir = readdir(dir)) != 0) {
291 if (strcmp(libdir->d_name, ".") == 0 ||
292 strcmp(libdir->d_name, "..") == 0)
297 std::string path = PLUGIN_PATH;
299 path += libdir->d_name;
303 if (stat(path.c_str(), &tmp) == -1) {
304 LogError("Failed to open file" << path);
308 if (!S_ISDIR(tmp.st_mode)) {
309 LogError("Not a directory" << path);
313 pluginsPaths.push_back(path);
316 //set nb of plugins to install
317 //this value indicate how many callbacks are expected
318 m_numPluginsToInstall = pluginsPaths.size();
319 LogInfo("Plugins to install: " << m_numPluginsToInstall);
320 m_pluginsPaths = pluginsPaths;
322 m_totalPlugins = m_numPluginsToInstall;
323 DPL::Event::ControllerEventHandler<WRTInstallerNS::InstallPluginEvent>
324 ::PostEvent(WRTInstallerNS::InstallPluginEvent());
326 if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
327 LogError("Failed to close dir: " << dir);
331 //void WrtInstaller::uninstallStep()
333 // LogDebug("Uninstalling widget ...");
334 // wrt_uninstall_widget(m_handle, this, &staticWrtStatusCallback,
335 // (!m_quiet || m_installByPkgmgr)
336 // ? &staticWrtUninstallProgressCallback : NULL);
339 //void WrtInstaller::uninstallPkgNameStep()
341 // LogDebug("Uninstalling widget ...");
342 // WrtErrStatus status = wrt_get_widget_by_pkgname(m_name, &m_handle);
343 // if (status == WRT_SUCCESS) {
344 // LogDebug("Get Widget Handle by package name : " << m_handle);
345 // wrt_uninstall_widget(m_handle, this, &staticWrtStatusCallback,
346 // (!m_quiet || m_installByPkgmgr)
347 // ? &staticWrtUninstallProgressCallback : NULL);
349 // printf("failed: can not uninstall widget\n");
350 // LogError("Fail to uninstalling widget... ");
351 // m_returnStatus = -1;
352 // DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
353 // WRTInstallerNS::QuitEvent());
357 //void WrtInstaller::uninstallGuidStep()
359 // LogDebug("Uninstalling widget ...");
360 // WrtErrStatus status = wrt_get_widget_by_guid(m_name, &m_handle);
361 // if (status == WRT_SUCCESS) {
362 // LogDebug("Get Widget Handle by guid : " << m_handle);
363 // wrt_uninstall_widget(m_handle, this, &staticWrtStatusCallback,
364 // !m_quiet ? &staticWrtUninstallProgressCallback : NULL);
366 // printf("failed: can not uninstall widget\n");
367 // LogError("Fail to uninstalling widget... ");
368 // m_returnStatus = -1;
369 // DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
370 // WRTInstallerNS::QuitEvent());
374 //void WrtInstaller::unistallWgtFileStep()
376 // LogDebug("Uninstalling widget ...");
380 // ParserRunner parser;
381 // ConfigParserData configInfo;
384 // DPL::ScopedPtr<DPL::ZipInput> zipFile(
385 // new DPL::ZipInput(m_packagePath));
387 // // Open config.xml file
388 // DPL::ScopedPtr<DPL::ZipInput::File> configFile(
389 // zipFile->OpenFile(CONFIG_XML));
392 // DPL::BinaryQueue buffer;
393 // DPL::AbstractWaitableInputAdapter inputAdapter(configFile.Get());
394 // DPL::AbstractWaitableOutputAdapter outputAdapter(&buffer);
395 // DPL::Copy(&inputAdapter, &outputAdapter);
396 // parser.Parse(&buffer,
398 // new RootParser<WidgetParser>(configInfo,
399 // DPL::FromUTF32String(
402 // DPL::OptionalString widgetGUID = configInfo.widget_id;
404 // std::string guid = DPL::ToUTF8String(*widgetGUID);
406 // WrtErrStatus status = wrt_get_widget_by_guid(guid, &m_handle);
407 // if (status == WRT_SUCCESS) {
408 // LogDebug("Get Widget Handle by guid : " << m_handle);
409 // wrt_uninstall_widget(m_handle, this, &staticWrtStatusCallback,
410 // !m_quiet ? &staticWrtUninstallProgressCallback : NULL);
412 // LogError("Fail to uninstalling widget... ");
413 // m_returnStatus = -1;
414 // DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
415 // WRTInstallerNS::QuitEvent());
418 // Catch(DPL::ZipInput::Exception::OpenFailed)
420 // LogError("Failed to open widget package");
421 // printf("failed: widget package does not exist\n");
422 // m_returnStatus = -1;
423 // DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
424 // WRTInstallerNS::QuitEvent());
426 // Catch(DPL::ZipInput::Exception::OpenFileFailed)
428 // printf("failed: widget config file does not exist\n");
429 // LogError("Failed to open config.xml file");
430 // m_returnStatus = -1;
431 // DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
432 // WRTInstallerNS::QuitEvent());
434 // Catch(ElementParser::Exception::ParseError)
436 // printf("failed: can not parse config file\n");
437 // LogError("Failed to parse config.xml file");
438 // m_returnStatus = -1;
439 // DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
440 // WRTInstallerNS::QuitEvent());
444 void WrtInstaller::shutdownStep()
446 LogDebug("Closing Wrt connection ...");
448 wrt_installer_shutdown();
449 m_initialized = false;
450 DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
451 WRTInstallerNS::QuitEvent());
455 void WrtInstaller::staticWrtInitCallback(WrtErrStatus status,
458 WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
461 if (status == WRT_SUCCESS) {
462 LogDebug("Init succesfull");
463 This->m_initialized = true;
464 This->m_returnStatus = 0;
466 // if (!This->m_quiet) {
467 // This->m_popup = new InstallerPopup;
468 // This->m_popup->init();
471 This->DPL::Event::ControllerEventHandler<WRTInstallerNS::NextStepEvent>
472 ::PostEvent(WRTInstallerNS::NextStepEvent());
474 LogError("Init unsuccesfull");
475 This->m_returnStatus = -1;
476 This->DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
477 WRTInstallerNS::QuitEvent());
481 //void WrtInstaller::staticWrtStatusCallback(int handle,
482 // WrtErrStatus status,
485 // WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
488 // Step current = This->GetCurrentStep();
489 // DPL::String resultMsg;
490 // std::string printMsg;
492 // if (current == &WrtInstaller::installStep)
494 // resultMsg = DPL::FromUTF8String(PKGMGR_INSTALL_MSG);
495 // printMsg = "installed";
496 // } else if (current == &WrtInstaller::uninstallStep ||
497 // current == &WrtInstaller::uninstallPkgNameStep ||
498 // current == &WrtInstaller::uninstallGuidStep ||
499 // current == &WrtInstaller::unistallWgtFileStep)
501 // resultMsg = DPL::FromUTF8String(PKGMGR_UNINSTALL_MSG);
502 // printMsg = "uninstalled";
505 // if (WRT_SUCCESS != status) {
507 // LogDebug("Step failed");
508 // This->m_returnStatus = -1;
510 // if (!This->m_quiet) {
511 // resultMsg += L" : " + DPL::FromUTF8String(PKGMGR_END_FAILURE);
512 // This->m_popup->showPopup(This, resultMsg, failResultCallback);
514 // This->DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>
515 // ::PostEvent(WRTInstallerNS::QuitEvent());
519 // case WRT_INSTALLER_ERROR_INVALID_WIDGET_PACKAGE:
520 // This->m_returnStatus = 1; //this status is specific
521 // printf("failed: invalid widget package\n");
524 // case WRT_INSTALLER_ERROR_WIDGET_DOES_NOT_EXIST:
525 // printf("failed: widget package does not exist\n");
528 // case WRT_INSTALLER_ERROR_FACTORY_WIDGET:
529 // printf("failed: factory widget\n");
532 // case WRT_INSTALLER_ERROR_ALREADY_UNINSTALLING:
533 // printf("failed: already uninstalling\n");
536 // case WRT_INSTALLER_ERROR_OUT_OUT_DISK_SPACE:
537 // printf("failed: out of disk space\n");
540 // case WRT_INSTALLER_ERROR_INVALID_CERTIFICATE:
541 // printf("failed: invalid certificate\n");
544 // case WRT_INSTALLER_ERROR_ALREADY_INSTALLED:
545 // printf("failed: already installed\n");
548 // case WRT_INSTALLER_ERROR_INTERNAL:
549 // printf("failed: internal error\n");
552 // case WRT_INSTALLER_ERROR_NOT_ALLOWED:
553 // printf("failed: installation or update not allowed; invalid"
557 // case WRT_INSTALLER_ERROR_DEFERRED:
558 // printf("deferred: widget update will continue after the widget"
559 // " has been stopped\n");
562 // case WRT_INSTALLER_ERROR_DATABASE_FAILURE:
563 // printf("failed: database failure\n");
566 // case WRT_INSTALLER_ERROR_OSPSVC:
567 // printf("failed: during installation or uninstallation osp service\n");
570 // case WRT_INSTALLER_ERROR_UNKNOWN:
571 // printf("failed: unknown error\n");
579 // printf("%s : %d\n", printMsg.c_str(), handle);
580 // LogDebug("Status succesfull");
581 // This->m_handle = handle;
582 // This->m_returnStatus = 0;
583 // resultMsg += L" : " + DPL::FromUTF8String(PKGMGR_END_SUCCESS);
585 // if (!This->m_quiet) {
586 // This->m_popup->showPopup(This, resultMsg, showResultCallback);
588 // This->DPL::Event::ControllerEventHandler<WRTInstallerNS::NextStepEvent>
589 // ::PostEvent(WRTInstallerNS::NextStepEvent());
594 void WrtInstaller::staticWrtPluginInstallationCallback(WrtErrStatus status,
599 PluginInstallerData* data = static_cast<PluginInstallerData*>(userdata);
601 WrtInstaller *This = static_cast<WrtInstaller*>(data->wrtInstaller);
603 std::string path = std::string(data->pluginPath);
606 This->m_numPluginsToInstall--;
607 LogDebug("Plugins to install: " << This->m_numPluginsToInstall);
609 if (This->m_numPluginsToInstall < 1) {
610 LogDebug("All plugins installation completed");
612 //remove installation request
613 if (!PluginUtils::removeInstallationRequiredFlag()) {
614 LogInfo("Failed to remove file initializing plugin installation");
618 if (!PluginUtils::unlockPluginInstallation()) {
619 LogInfo("Failed to remove installation lock");
622 // if (!This->m_quiet) {
623 // This->m_popup->init();
624 // elm_progressbar_value_set(This->m_popup->m_progressbar, 100.0);
625 // evas_object_show(This->m_popup->m_popup);
628 This->DPL::Event::ControllerEventHandler<WRTInstallerNS::NextStepEvent>
629 ::PostEvent(WRTInstallerNS::NextStepEvent());
631 // if (!This->m_quiet) {
632 // This->m_popup->init();
633 // float percent = (This->m_totalPlugins - This->m_numPluginsToInstall)/(float)This->m_totalPlugins;
634 // elm_progressbar_value_set(This->m_popup->m_progressbar, percent);
635 // evas_object_show(This->m_popup->m_popup);
638 This->DPL::Event::ControllerEventHandler<WRTInstallerNS::InstallPluginEvent>::PostEvent(
639 WRTInstallerNS::InstallPluginEvent());
642 if (WRT_SUCCESS == status) {
643 This->m_returnStatus = 0;
644 LogDebug("One plugin Installation succesfull: " << path);
649 LogWarning("One of the plugins installation failed!: " << path);
651 if (WRT_PLUGIN_INSTALLER_ERROR_WAITING == status) {
652 LogInfo("Plugin installation is waiting for dependencies");
656 case WRT_PLUGIN_INSTALLER_ERROR_WRONG_PATH:
657 LogError("failed: wrong path to plugin directory\n");
660 case WRT_PLUGIN_INSTALLER_ERROR_METAFILE:
661 LogError("failed: plugin metafile error\n");
664 case WRT_PLUGIN_INSTALLER_ERROR_ALREADY_INSTALLED:
665 LogError("failed: plugin already installed\n");
668 case WRT_PLUGIN_INSTALLER_ERROR_LIBRARY_ERROR:
669 LogError("failed: plugin library: missing symbols or structures\n");
672 case WRT_PLUGIN_INSTALLER_ERROR_UNKNOWN:
673 LogError("failed: unknown error\n");
681 void WrtInstaller::staticWrtPluginInstallProgressCb(float percent,
682 const char* description,
685 PluginInstallerData* data = static_cast<PluginInstallerData*>(userdata);
687 std::string path = std::string(data->pluginPath);
689 LogInfo("Plugin Installation: " << path <<
690 " progress: " << percent <<
691 "description " << description);
694 //void WrtInstaller::staticWrtInstallProgressCallback(float percent,
695 // const char* description, void* userdata)
697 // WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
698 // std::stringstream percentStr;
699 // LogInfo(" progress: " << percent <<
700 // " description: " << description);
702 // if (!This->m_quiet) {
703 // This->m_popup->init();
704 // elm_progressbar_value_set(This->m_popup->m_progressbar, percent/100.0);
705 // evas_object_show(This->m_popup->m_popup);
708 //void WrtInstaller::staticWrtUninstallProgressCallback(float percent,
709 // const char* description, void* userdata)
711 // WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
712 // std::stringstream percentStr;
713 // LogInfo(" progress: " << percent <<
714 // " description: " << description);
716 // if (!This->m_quiet) {
717 // This->m_popup->init();
718 // elm_progressbar_value_set(This->m_popup->m_progressbar, percent/100.0);
719 // evas_object_show(This->m_popup->m_popup);
724 WrtInstaller::InstallerPopup::InstallerPopup() :
731 WrtInstaller::InstallerPopup::~InstallerPopup()
733 LogDebug("App Finished");
736 void WrtInstaller::InstallerPopup::init()
738 LogDebug("Window Init");
742 m_win = createWin("wrt-installer");
745 m_popup = elm_popup_add(m_win);
747 // create progressbar
748 m_progressbar = elm_progressbar_add(m_popup);
749 elm_object_style_set(m_progressbar, "list_progress");
750 elm_progressbar_horizontal_set(m_progressbar, EINA_TRUE);
751 evas_object_size_hint_align_set(m_progressbar, EVAS_HINT_FILL,
753 evas_object_size_hint_weight_set(m_progressbar, EVAS_HINT_EXPAND,
755 elm_object_content_set(m_popup, m_progressbar);
756 elm_progressbar_value_set(m_progressbar, 0.0);
757 evas_object_show(m_progressbar);
759 evas_object_show(m_popup);
760 evas_object_show(m_win);
764 Evas_Object* WrtInstaller::InstallerPopup::createWin(const char *name)
767 win = elm_win_add(NULL, name, ELM_WIN_DIALOG_BASIC);
773 elm_win_alpha_set(win, EINA_TRUE);
774 elm_win_title_set(win, name);
775 elm_win_borderless_set(win, EINA_TRUE);
778 ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
779 evas_object_resize(win, w, h);
783 void WrtInstaller::InstallerPopup::showPopup(void* userdata,
784 const DPL::String& pkgMsg,
785 ShowResultCallback callback)
790 LogDebug("Result Popup Created");
791 evas_object_del(m_popup);
794 m_popup = elm_popup_add(m_win);
798 btn = elm_button_add(m_popup);
800 evas_object_del(m_popup);
803 elm_object_text_set(btn, "OK");
804 evas_object_smart_callback_add(btn, "clicked", callback, userdata);
805 elm_object_part_content_set(m_popup, "button1", btn);
806 elm_object_part_text_set(m_popup, "title,text", "RESULT");
807 elm_object_text_set(m_popup, DPL::ToUTF8String(pkgMsg).c_str());
809 evas_object_show(m_popup);
810 evas_object_show(m_win);
815 //void WrtInstaller::showResultCallback(void *data, Evas_Object* /*obj*/,
816 // void* /*event_info*/)
818 // WrtInstaller *This = static_cast<WrtInstaller*>(data);
821 // This->DPL::Event::ControllerEventHandler<WRTInstallerNS::NextStepEvent>
822 // ::PostEvent(WRTInstallerNS::NextStepEvent());
825 //void WrtInstaller::failResultCallback(void *data, Evas_Object* /*obj*/,
826 // void* /*event_info*/)
828 // WrtInstaller *This = static_cast<WrtInstaller*>(data);
831 // This->DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>
832 // ::PostEvent(WRTInstallerNS::QuitEvent());
835 void WrtInstaller::installNewPlugins()
837 LogDebug("Install new plugins");
839 if (!PluginUtils::lockPluginInstallation()) {
840 LogInfo("Lock NOT created");
844 if (!PluginUtils::checkPluginInstallationRequired()) {
845 LogDebug("Plugin installation not required");
846 PluginUtils::unlockPluginInstallation();
850 m_startupPluginInstallation = true;
851 AddStep(&WrtInstaller::installPluginsStep);
854 int main(int argc, char *argv[])
856 // Output on stdout will be flushed after every newline character,
857 // even if it is redirected to a pipe. This is useful for running
858 // from a script and parsing output.
859 // (Standard behavior of stdlib is to use full buffering when
860 // redirected to a pipe, which means even after an end of line
861 // the output may not be flushed).
864 // Check and re-set the file open limitation
866 if (getrlimit(RLIMIT_NOFILE, &rlim) != -1) {
867 LogDebug("RLIMIT_NOFILE sft(" << rlim.rlim_cur << ")" );
868 LogDebug("RLIMIT_NOFILE hrd(" << rlim.rlim_max << ")" );
870 if (rlim.rlim_cur < NOFILE_CNT_FOR_INSTALLER) {
871 rlim.rlim_cur = NOFILE_CNT_FOR_INSTALLER;
872 rlim.rlim_max = NOFILE_CNT_FOR_INSTALLER;
873 if (setrlimit(RLIMIT_NOFILE, &rlim) == -1) {
874 LogError("setrlimit is fail!!");
878 LogError("getrlimit is fail!!");
881 // set evas backend type for emulator
882 // popup isn't showed in the emulator,
883 // if backend isn't set to SW backend
884 // if (GlobalSettings::IsEmulator()) {
885 // if (setenv("ELM_ENGINE", "x11", 1)) {
886 // LogDebug("Enable backend");
890 WrtInstaller app(argc, argv);
891 int ret = app.Exec();
892 LogDebug("App returned: " << ret);
893 ret = app.getReturnStatus();
894 LogDebug("WrtInstaller returned: " << ret);