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"
27 #include <sys/resource.h>
28 #include <dpl/optional.h>
29 #include <dpl/scoped_free.h>
30 #include <dpl/optional_typedefs.h>
31 #include <dpl/exception.h>
32 #include <dpl/sstream.h>
34 #include <dpl/wrt-dao-ro/global_config.h>
35 #include <dpl/wrt-dao-ro/config_parser_data.h>
36 #include <dpl/localization/localization_utils.h>
37 #include <dpl/popup/popup_controller.h>
38 #include <dpl/optional_typedefs.h>
39 #include <dpl/string.h>
40 #include <dpl/abstract_waitable_input_adapter.h>
41 #include <dpl/abstract_waitable_output_adapter.h>
42 #include <dpl/zip_input.h>
43 #include <dpl/scoped_ptr.h>
44 #include <dpl/binary_queue.h>
46 #include <dpl/utils/wrt_global_settings.h>
47 #include "option_parser.h"
48 #include <parser_runner.h>
49 #include <widget_parser.h>
50 #include <root_parser.h>
51 //#include <pkg-manager/pkgmgr_signal.h>
53 #define NOFILE_CNT_FOR_INSTALLER 9999
55 using namespace WrtDB;
57 namespace { // anonymous
58 const char AUL_ARG_KEY[] = "widget_arg";
59 const char * const PKGMGR_INSTALL_MSG = "Install widget";
60 const char * const PKGMGR_UNINSTALL_MSG = "Uninstall widget";
62 const double BASE_LAYOUT_W = 720.0f;
63 const double BASE_LAYOUT_H = 1280.0f;
65 const char * const CONFIG_XML = "config.xml";
67 struct PluginInstallerData
70 std::string pluginPath;
72 } // namespace anonymous
74 WrtInstaller::WrtInstaller(int argc, char **argv) :
75 Application(argc, argv, "backend", false),
76 DPL::TaskDecl<WrtInstaller>(this),
80 m_numPluginsToInstall(0),
83 // m_installByPkgmgr(false),
86 m_startupPluginInstallation(false)
89 LogDebug("App Created");
92 WrtInstaller::~WrtInstaller()
94 LogDebug("App Finished");
97 void WrtInstaller::OnStop()
99 LogInfo("Stopping Dummy Client");
102 void WrtInstaller::OnCreate()
104 LogInfo("Creating DummyClient");
106 AddStep(&WrtInstaller::initStep);
108 std::string arg = m_argv[0];
111 return showHelpAndQuit();
116 if (arg.find("wrt-installer") != std::string::npos)
119 return showHelpAndQuit();
123 if (arg == "-h" || arg == "--help") {
125 return showHelpAndQuit();
129 return showHelpAndQuit();
130 } else if (arg == "-p" || arg == "--install-plugins") {
132 return showHelpAndQuit();
134 if (!m_startupPluginInstallation) {
135 AddStep(&WrtInstaller::installPluginsStep);
137 LogInfo("Plugin installation alredy started");
142 LogError("Unknown option");
143 return showHelpAndQuit();
147 AddStep(&WrtInstaller::shutdownStep);
148 DPL::Event::ControllerEventHandler<
149 WRTInstallerNS::NextStepEvent>::PostEvent(
150 WRTInstallerNS::NextStepEvent());
153 //void WrtInstaller::OnReset(bundle *b)
155 // const char * bundledVal = bundle_get_val(b, AUL_ARG_KEY);
156 // if (bundledVal != NULL) {
157 // m_bundleValue = bundledVal;
158 // LogInfo("Bundled value for (" << AUL_ARG_KEY << ") key received: " <<
163 int WrtInstaller::getReturnStatus() const
165 if (!m_returnStatus) {
172 void WrtInstaller::OnTerminate()
174 LogDebug("Wrt Shutdown now");
175 PluginUtils::unlockPluginInstallation();
177 wrt_installer_shutdown();
182 void WrtInstaller::showHelpAndQuit()
184 printf("Usage: wrt-installer [OPTION]... [WIDGET: ID/NAME/GUID/PATH]...\n"
185 "Operate with WebRuntime daemon: install, uninstall"
186 " and launch widgets.\n"
187 "Query list of installed widgets and setup up debugging support.\n"
189 "Exactly one option must be selected.\n"
190 "Mandatory arguments to long options are mandatory for short "
192 " -h, --help show this help\n"
193 " -p, --install-plugins install plugins\n"
199 void WrtInstaller::OnEventReceived(const WRTInstallerNS::QuitEvent& /*event*/)
204 LogDebug("Wrt Shutdown now");
205 SwitchToStep(&WrtInstaller::shutdownStep);
206 DPL::Event::ControllerEventHandler<WRTInstallerNS::NextStepEvent>::PostEvent(
207 WRTInstallerNS::NextStepEvent());
209 LogDebug("Quiting application");
214 void WrtInstaller::OnEventReceived(
215 const WRTInstallerNS::NextStepEvent& /*event*/)
217 LogDebug("Executing next step");
221 void WrtInstaller::OnEventReceived(
222 const WRTInstallerNS::InstallPluginEvent& /*event*/)
224 PluginInstallerData* privateData = new PluginInstallerData;
225 privateData->wrtInstaller = this;
227 if (m_pluginsPaths) {
228 privateData->pluginPath = m_pluginsPaths->front();
229 m_pluginsPaths->pop_front();
231 wrt_install_plugin(privateData->pluginPath.c_str(),
232 static_cast<void*>(privateData),
233 &staticWrtPluginInstallationCallback,
234 &staticWrtPluginInstallProgressCb);
240 void WrtInstaller::initStep()
242 wrt_installer_init(this, staticWrtInitCallback);
245 //void WrtInstaller::installStep()
247 // LogDebug("Installing widget ...");
248 // DPL::ScopedFree<char> packagePath(canonicalize_file_name(
249 // m_packagePath.c_str()));
251 // wrt_install_widget(packagePath ? packagePath.Get() : m_packagePath.c_str(),
252 // this, &staticWrtStatusCallback,
253 // (!m_quiet || m_installByPkgmgr)
254 // ? &staticWrtInstallProgressCallback : NULL,
259 void WrtInstaller::installPluginsStep()
261 LogDebug("Installing plugins ...");
263 if (m_startupPluginInstallation) {
264 LogInfo("Plugin installation started because new plugin package found");
265 } else if (!PluginUtils::lockPluginInstallation()) {
266 LogError("Failed to open plugin installation lock file"
267 " Plugins are currently installed by other process");
268 staticWrtPluginInstallationCallback(WRT_PLUGIN_INSTALLER_ERROR_LOCK,
273 PluginUtils::PluginPathListPtr pluginPaths = PluginUtils::getPluginPaths();
278 //set nb of plugins to install
279 //this value indicate how many callbacks are expected
280 m_numPluginsToInstall = pluginPaths->size();
281 LogInfo("Plugins to install: " << m_numPluginsToInstall);
282 m_pluginsPaths = pluginPaths;
284 m_totalPlugins = m_numPluginsToInstall;
285 DPL::Event::ControllerEventHandler<WRTInstallerNS::InstallPluginEvent>
286 ::PostEvent(WRTInstallerNS::InstallPluginEvent());
289 //void WrtInstaller::uninstallStep()
291 // LogDebug("Uninstalling widget ...");
292 // wrt_uninstall_widget(m_handle, this, &staticWrtStatusCallback,
293 // (!m_quiet || m_installByPkgmgr)
294 // ? &staticWrtUninstallProgressCallback : NULL);
297 //void WrtInstaller::uninstallPkgNameStep()
299 // LogDebug("Uninstalling widget ...");
300 // WrtErrStatus status = wrt_get_widget_by_pkgname(m_name, &m_handle);
301 // if (status == WRT_SUCCESS) {
302 // LogDebug("Get Widget Handle by package name : " << m_handle);
303 // wrt_uninstall_widget(m_handle, this, &staticWrtStatusCallback,
304 // (!m_quiet || m_installByPkgmgr)
305 // ? &staticWrtUninstallProgressCallback : NULL);
307 // printf("failed: can not uninstall widget\n");
308 // LogError("Fail to uninstalling widget... ");
309 // m_returnStatus = -1;
310 // DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
311 // WRTInstallerNS::QuitEvent());
315 //void WrtInstaller::uninstallGuidStep()
317 // LogDebug("Uninstalling widget ...");
318 // WrtErrStatus status = wrt_get_widget_by_guid(m_name, &m_handle);
319 // if (status == WRT_SUCCESS) {
320 // LogDebug("Get Widget Handle by guid : " << m_handle);
321 // wrt_uninstall_widget(m_handle, this, &staticWrtStatusCallback,
322 // !m_quiet ? &staticWrtUninstallProgressCallback : NULL);
324 // printf("failed: can not uninstall widget\n");
325 // LogError("Fail to uninstalling widget... ");
326 // m_returnStatus = -1;
327 // DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
328 // WRTInstallerNS::QuitEvent());
332 //void WrtInstaller::unistallWgtFileStep()
334 // LogDebug("Uninstalling widget ...");
338 // ParserRunner parser;
339 // ConfigParserData configInfo;
342 // DPL::ScopedPtr<DPL::ZipInput> zipFile(
343 // new DPL::ZipInput(m_packagePath));
345 // // Open config.xml file
346 // DPL::ScopedPtr<DPL::ZipInput::File> configFile(
347 // zipFile->OpenFile(CONFIG_XML));
350 // DPL::BinaryQueue buffer;
351 // DPL::AbstractWaitableInputAdapter inputAdapter(configFile.Get());
352 // DPL::AbstractWaitableOutputAdapter outputAdapter(&buffer);
353 // DPL::Copy(&inputAdapter, &outputAdapter);
354 // parser.Parse(&buffer,
356 // new RootParser<WidgetParser>(configInfo,
357 // DPL::FromUTF32String(
360 // DPL::OptionalString widgetGUID = configInfo.widget_id;
362 // std::string guid = DPL::ToUTF8String(*widgetGUID);
364 // WrtErrStatus status = wrt_get_widget_by_guid(guid, &m_handle);
365 // if (status == WRT_SUCCESS) {
366 // LogDebug("Get Widget Handle by guid : " << m_handle);
367 // wrt_uninstall_widget(m_handle, this, &staticWrtStatusCallback,
368 // !m_quiet ? &staticWrtUninstallProgressCallback : NULL);
370 // LogError("Fail to uninstalling widget... ");
371 // m_returnStatus = -1;
372 // DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
373 // WRTInstallerNS::QuitEvent());
376 // Catch(DPL::ZipInput::Exception::OpenFailed)
378 // LogError("Failed to open widget package");
379 // printf("failed: widget package does not exist\n");
380 // m_returnStatus = -1;
381 // DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
382 // WRTInstallerNS::QuitEvent());
384 // Catch(DPL::ZipInput::Exception::OpenFileFailed)
386 // printf("failed: widget config file does not exist\n");
387 // LogError("Failed to open config.xml file");
388 // m_returnStatus = -1;
389 // DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
390 // WRTInstallerNS::QuitEvent());
392 // Catch(ElementParser::Exception::ParseError)
394 // printf("failed: can not parse config file\n");
395 // LogError("Failed to parse config.xml file");
396 // m_returnStatus = -1;
397 // DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
398 // WRTInstallerNS::QuitEvent());
402 void WrtInstaller::shutdownStep()
404 LogDebug("Closing Wrt connection ...");
406 wrt_installer_shutdown();
407 m_initialized = false;
408 DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
409 WRTInstallerNS::QuitEvent());
413 void WrtInstaller::staticWrtInitCallback(WrtErrStatus status,
416 WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
419 if (status == WRT_SUCCESS) {
420 LogDebug("Init succesfull");
421 This->m_initialized = true;
422 This->m_returnStatus = 0;
424 // if (!This->m_quiet) {
425 // This->m_popup = new InstallerPopup;
426 // This->m_popup->init();
429 This->DPL::Event::ControllerEventHandler<WRTInstallerNS::NextStepEvent>
430 ::PostEvent(WRTInstallerNS::NextStepEvent());
432 LogError("Init unsuccesfull");
433 This->m_returnStatus = -1;
434 This->DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
435 WRTInstallerNS::QuitEvent());
439 //void WrtInstaller::staticWrtStatusCallback(int handle,
440 // WrtErrStatus status,
443 // WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
446 // Step current = This->GetCurrentStep();
447 // DPL::String resultMsg;
448 // std::string printMsg;
450 // if (current == &WrtInstaller::installStep)
452 // resultMsg = DPL::FromUTF8String(PKGMGR_INSTALL_MSG);
453 // printMsg = "installed";
454 // } else if (current == &WrtInstaller::uninstallStep ||
455 // current == &WrtInstaller::uninstallPkgNameStep ||
456 // current == &WrtInstaller::uninstallGuidStep ||
457 // current == &WrtInstaller::unistallWgtFileStep)
459 // resultMsg = DPL::FromUTF8String(PKGMGR_UNINSTALL_MSG);
460 // printMsg = "uninstalled";
463 // if (WRT_SUCCESS != status) {
465 // LogDebug("Step failed");
466 // This->m_returnStatus = -1;
468 // if (!This->m_quiet) {
469 // resultMsg += L" : " + DPL::FromUTF8String(PKGMGR_END_FAILURE);
470 // This->m_popup->showPopup(This, resultMsg, failResultCallback);
472 // This->DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>
473 // ::PostEvent(WRTInstallerNS::QuitEvent());
477 // case WRT_INSTALLER_ERROR_INVALID_WIDGET_PACKAGE:
478 // This->m_returnStatus = 1; //this status is specific
479 // printf("failed: invalid widget package\n");
482 // case WRT_INSTALLER_ERROR_WIDGET_DOES_NOT_EXIST:
483 // printf("failed: widget package does not exist\n");
486 // case WRT_INSTALLER_ERROR_FACTORY_WIDGET:
487 // printf("failed: factory widget\n");
490 // case WRT_INSTALLER_ERROR_ALREADY_UNINSTALLING:
491 // printf("failed: already uninstalling\n");
494 // case WRT_INSTALLER_ERROR_OUT_OUT_DISK_SPACE:
495 // printf("failed: out of disk space\n");
498 // case WRT_INSTALLER_ERROR_INVALID_CERTIFICATE:
499 // printf("failed: invalid certificate\n");
502 // case WRT_INSTALLER_ERROR_ALREADY_INSTALLED:
503 // printf("failed: already installed\n");
506 // case WRT_INSTALLER_ERROR_INTERNAL:
507 // printf("failed: internal error\n");
510 // case WRT_INSTALLER_ERROR_NOT_ALLOWED:
511 // printf("failed: installation or update not allowed; invalid"
515 // case WRT_INSTALLER_ERROR_DEFERRED:
516 // printf("deferred: widget update will continue after the widget"
517 // " has been stopped\n");
520 // case WRT_INSTALLER_ERROR_DATABASE_FAILURE:
521 // printf("failed: database failure\n");
524 // case WRT_INSTALLER_ERROR_OSPSVC:
525 // printf("failed: during installation or uninstallation osp service\n");
528 // case WRT_INSTALLER_ERROR_UNKNOWN:
529 // printf("failed: unknown error\n");
537 // printf("%s : %d\n", printMsg.c_str(), handle);
538 // LogDebug("Status succesfull");
539 // This->m_handle = handle;
540 // This->m_returnStatus = 0;
541 // resultMsg += L" : " + DPL::FromUTF8String(PKGMGR_END_SUCCESS);
543 // if (!This->m_quiet) {
544 // This->m_popup->showPopup(This, resultMsg, showResultCallback);
546 // This->DPL::Event::ControllerEventHandler<WRTInstallerNS::NextStepEvent>
547 // ::PostEvent(WRTInstallerNS::NextStepEvent());
552 void WrtInstaller::staticWrtPluginInstallationCallback(WrtErrStatus status,
557 PluginInstallerData* data = static_cast<PluginInstallerData*>(userdata);
559 WrtInstaller *This = static_cast<WrtInstaller*>(data->wrtInstaller);
561 std::string path = std::string(data->pluginPath);
564 This->m_numPluginsToInstall--;
565 LogDebug("Plugins to install: " << This->m_numPluginsToInstall);
567 if (This->m_numPluginsToInstall < 1) {
568 LogDebug("All plugins installation completed");
570 //remove installation request
571 if (!PluginUtils::removeInstallationRequiredFlag()) {
572 LogInfo("Failed to remove file initializing plugin installation");
576 if (!PluginUtils::unlockPluginInstallation()) {
577 LogInfo("Failed to remove installation lock");
580 // if (!This->m_quiet) {
581 // This->m_popup->init();
582 // elm_progressbar_value_set(This->m_popup->m_progressbar, 100.0);
583 // evas_object_show(This->m_popup->m_popup);
586 This->DPL::Event::ControllerEventHandler<WRTInstallerNS::NextStepEvent>
587 ::PostEvent(WRTInstallerNS::NextStepEvent());
589 // if (!This->m_quiet) {
590 // This->m_popup->init();
591 // float percent = (This->m_totalPlugins - This->m_numPluginsToInstall)/(float)This->m_totalPlugins;
592 // elm_progressbar_value_set(This->m_popup->m_progressbar, percent);
593 // evas_object_show(This->m_popup->m_popup);
596 This->DPL::Event::ControllerEventHandler<WRTInstallerNS::InstallPluginEvent>::PostEvent(
597 WRTInstallerNS::InstallPluginEvent());
600 if (WRT_SUCCESS == status) {
601 This->m_returnStatus = 0;
602 LogDebug("One plugin Installation succesfull: " << path);
607 LogWarning("One of the plugins installation failed!: " << path);
609 if (WRT_PLUGIN_INSTALLER_ERROR_WAITING == status) {
610 LogInfo("Plugin installation is waiting for dependencies");
614 case WRT_PLUGIN_INSTALLER_ERROR_WRONG_PATH:
615 LogError("failed: wrong path to plugin directory\n");
618 case WRT_PLUGIN_INSTALLER_ERROR_METAFILE:
619 LogError("failed: plugin metafile error\n");
622 case WRT_PLUGIN_INSTALLER_ERROR_ALREADY_INSTALLED:
623 LogError("failed: plugin already installed\n");
626 case WRT_PLUGIN_INSTALLER_ERROR_LIBRARY_ERROR:
627 LogError("failed: plugin library: missing symbols or structures\n");
630 case WRT_PLUGIN_INSTALLER_ERROR_UNKNOWN:
631 LogError("failed: unknown error\n");
639 void WrtInstaller::staticWrtPluginInstallProgressCb(float percent,
640 const char* description,
643 PluginInstallerData* data = static_cast<PluginInstallerData*>(userdata);
645 std::string path = std::string(data->pluginPath);
647 LogInfo("Plugin Installation: " << path <<
648 " progress: " << percent <<
649 "description " << description);
652 //void WrtInstaller::staticWrtInstallProgressCallback(float percent,
653 // const char* description, void* userdata)
655 // WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
656 // std::stringstream percentStr;
657 // LogInfo(" progress: " << percent <<
658 // " description: " << description);
660 // if (!This->m_quiet) {
661 // This->m_popup->init();
662 // elm_progressbar_value_set(This->m_popup->m_progressbar, percent/100.0);
663 // evas_object_show(This->m_popup->m_popup);
666 //void WrtInstaller::staticWrtUninstallProgressCallback(float percent,
667 // const char* description, void* userdata)
669 // WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
670 // std::stringstream percentStr;
671 // LogInfo(" progress: " << percent <<
672 // " description: " << description);
674 // if (!This->m_quiet) {
675 // This->m_popup->init();
676 // elm_progressbar_value_set(This->m_popup->m_progressbar, percent/100.0);
677 // evas_object_show(This->m_popup->m_popup);
682 WrtInstaller::InstallerPopup::InstallerPopup() :
689 WrtInstaller::InstallerPopup::~InstallerPopup()
691 LogDebug("App Finished");
694 void WrtInstaller::InstallerPopup::init()
696 LogDebug("Window Init");
700 m_win = createWin("wrt-installer");
703 m_popup = elm_popup_add(m_win);
705 // create progressbar
706 m_progressbar = elm_progressbar_add(m_popup);
707 elm_object_style_set(m_progressbar, "list_progress");
708 elm_progressbar_horizontal_set(m_progressbar, EINA_TRUE);
709 evas_object_size_hint_align_set(m_progressbar, EVAS_HINT_FILL,
711 evas_object_size_hint_weight_set(m_progressbar, EVAS_HINT_EXPAND,
713 elm_object_content_set(m_popup, m_progressbar);
714 elm_progressbar_value_set(m_progressbar, 0.0);
715 evas_object_show(m_progressbar);
717 evas_object_show(m_popup);
718 evas_object_show(m_win);
722 Evas_Object* WrtInstaller::InstallerPopup::createWin(const char *name)
725 win = elm_win_add(NULL, name, ELM_WIN_DIALOG_BASIC);
731 elm_win_alpha_set(win, EINA_TRUE);
732 elm_win_title_set(win, name);
733 elm_win_borderless_set(win, EINA_TRUE);
736 ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
737 evas_object_resize(win, w, h);
741 void WrtInstaller::InstallerPopup::showPopup(void* userdata,
742 const DPL::String& pkgMsg,
743 ShowResultCallback callback)
748 LogDebug("Result Popup Created");
749 evas_object_del(m_popup);
752 m_popup = elm_popup_add(m_win);
756 btn = elm_button_add(m_popup);
758 evas_object_del(m_popup);
761 elm_object_text_set(btn, "OK");
762 evas_object_smart_callback_add(btn, "clicked", callback, userdata);
763 elm_object_part_content_set(m_popup, "button1", btn);
764 elm_object_part_text_set(m_popup, "title,text", "RESULT");
765 elm_object_text_set(m_popup, DPL::ToUTF8String(pkgMsg).c_str());
767 evas_object_show(m_popup);
768 evas_object_show(m_win);
773 //void WrtInstaller::showResultCallback(void *data, Evas_Object* /*obj*/,
774 // void* /*event_info*/)
776 // WrtInstaller *This = static_cast<WrtInstaller*>(data);
779 // This->DPL::Event::ControllerEventHandler<WRTInstallerNS::NextStepEvent>
780 // ::PostEvent(WRTInstallerNS::NextStepEvent());
783 //void WrtInstaller::failResultCallback(void *data, Evas_Object* /*obj*/,
784 // void* /*event_info*/)
786 // WrtInstaller *This = static_cast<WrtInstaller*>(data);
789 // This->DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>
790 // ::PostEvent(WRTInstallerNS::QuitEvent());
793 void WrtInstaller::installNewPlugins()
795 LogDebug("Install new plugins");
797 if (!PluginUtils::lockPluginInstallation()) {
798 LogInfo("Lock NOT created");
802 if (!PluginUtils::checkPluginInstallationRequired()) {
803 LogDebug("Plugin installation not required");
804 PluginUtils::unlockPluginInstallation();
808 m_startupPluginInstallation = true;
809 AddStep(&WrtInstaller::installPluginsStep);
812 int main(int argc, char *argv[])
814 // Output on stdout will be flushed after every newline character,
815 // even if it is redirected to a pipe. This is useful for running
816 // from a script and parsing output.
817 // (Standard behavior of stdlib is to use full buffering when
818 // redirected to a pipe, which means even after an end of line
819 // the output may not be flushed).
822 // Check and re-set the file open limitation
824 if (getrlimit(RLIMIT_NOFILE, &rlim) != -1) {
825 LogDebug("RLIMIT_NOFILE sft(" << rlim.rlim_cur << ")" );
826 LogDebug("RLIMIT_NOFILE hrd(" << rlim.rlim_max << ")" );
828 if (rlim.rlim_cur < NOFILE_CNT_FOR_INSTALLER) {
829 rlim.rlim_cur = NOFILE_CNT_FOR_INSTALLER;
830 rlim.rlim_max = NOFILE_CNT_FOR_INSTALLER;
831 if (setrlimit(RLIMIT_NOFILE, &rlim) == -1) {
832 LogError("setrlimit is fail!!");
836 LogError("getrlimit is fail!!");
839 // set evas backend type for emulator
840 // popup isn't showed in the emulator,
841 // if backend isn't set to SW backend
842 // if (GlobalSettings::IsEmulator()) {
843 // if (setenv("ELM_ENGINE", "x11", 1)) {
844 // LogDebug("Enable backend");
848 WrtInstaller app(argc, argv);
849 int ret = app.Exec();
850 LogDebug("App returned: " << ret);
851 ret = app.getReturnStatus();
852 LogDebug("WrtInstaller returned: " << ret);