#include <parser_runner.h>
#include <widget_parser.h>
#include <root_parser.h>
+#include <pkgmgr-info.h>
#include <Elementary.h>
WrtInstaller::WrtInstaller(int argc, char **argv) :
Application(argc, argv, "backend", false),
DPL::TaskDecl<WrtInstaller>(this),
- m_installMode(WRT_INSTALL_MODE_UNKNOWN),
m_packagePath(),
m_initialized(false),
m_numPluginsToInstall(0),
m_totalPlugins(0),
m_returnStatus(-1),
m_installByPkgmgr(false),
- m_quiet(true),
m_startupPluginInstallation(false)
{
Touch();
int WrtInstaller::getReturnStatus() const
{
- if (!m_returnStatus) {
- return RE_SUCCESS;
- } else {
- return RE_FAIL;
- }
+ return m_returnStatus;
}
void WrtInstaller::OnStop()
{
- LogInfo("Stopping Dummy Client");
+ LogDebug("Stopping Dummy Client");
}
void WrtInstaller::OnCreate()
{
- LogInfo("Creating DummyClient");
- fprintf(stderr,
- "===========================================================\n");
- fprintf(stderr, "# wrt-installer #\n");
- fprintf(stderr, "# argc [%d]\n", m_argc);
- fprintf(stderr, "# argv[0] = [%s]\n", m_argv[0]);
- fprintf(stderr, "# argv[1] = [%s]\n", m_argv[1]);
- fprintf(stderr, "# argv[2] = [%s]\n", m_argv[2]);
- fprintf(stderr,
- "===========================================================\n");
+ LogDebug("Creating DummyClient");
+ showArguments();
AddStep(&WrtInstaller::initStep);
if (!m_startupPluginInstallation) {
AddStep(&WrtInstaller::installPluginsStep);
} else {
- LogInfo("Plugin installation alredy started");
+ LogDebug("Plugin installation alredy started");
}
} else if (arg == "-i" || arg == "--install") {
if (m_argc != 3) {
struct stat info;
if (-1 != stat(m_argv[2], &info) && S_ISDIR(info.st_mode)) {
- LogInfo("Installing package directly from directory");
- m_installMode = WRT_INSTALL_MODE_INSTALL_DIRECTORY;
+ LogDebug("Installing package directly from directory");
+ m_installMode.extension = InstallMode::ExtensionType::DIR;
} else {
- LogInfo("Installing from regular location");
- m_installMode = WRT_INSTALL_MODE_INSTALL_WGT;
+ LogDebug("Installing from regular location");
+ m_installMode.extension = InstallMode::ExtensionType::WGT;
}
m_packagePath = m_argv[2];
return showHelpAndQuit();
}
m_packagePath = m_argv[2];
- m_installMode = WRT_INSTALL_MODE_INSTALL_PRELOAD;
+ m_installMode.installTime = InstallMode::InstallTime::PRELOAD;
+ m_installMode.rootPath = InstallMode::RootPath::RO;
+ AddStep(&WrtInstaller::installStep);
+ } else if (arg == "-ipw" || arg == "--install-preload-writable") {
+ LogDebug("Install preload web application to writable storage");
+ if (m_argc != 3) {
+ return showHelpAndQuit();
+ }
+ m_packagePath = m_argv[2];
+ m_installMode.installTime = InstallMode::InstallTime::PRELOAD;
+ m_installMode.rootPath = InstallMode::RootPath::RW;
AddStep(&WrtInstaller::installStep);
} else if (arg == "-c" || arg == "--csc-update") {
// "path=/opt/system/csc/Ozq2iEG15R-2.0.0-arm.wgt:op=install:removable=true"
if (it->second == CSCConfiguration::VALUE_INSTALL) {
LogDebug("operation = " << it->second);
- m_installMode = WRT_INSTALL_MODE_INSTALL_WGT;
+ m_installMode.extension = InstallMode::ExtensionType::WGT;
it = m_CSCconfigurationMap.find(CSCConfiguration::KEY_PATH);
if (it == m_CSCconfigurationMap.end()) {
return showHelpAndQuit();
}
m_packagePath = it->second;
+
+ it = m_CSCconfigurationMap.find(
+ CSCConfiguration::KEY_REMOVABLE);
+ if (it == m_CSCconfigurationMap.end()) {
+ return showHelpAndQuit();
+ }
+
+ m_installMode.removable =
+ (it->second.compare(CSCConfiguration::VALUE_FALSE) == 0)
+ ? false : true;
+
AddStep(&WrtInstaller::installStep);
LogDebug("path = " << m_packagePath);
} else if (it->second == CSCConfiguration::VALUE_UNINSTALL) {
if (m_argc != 3) {
return showHelpAndQuit();
}
- LogInfo("Installing package directly from directory");
- m_installMode = WRT_INSTALL_MODE_REINSTALL;
+ LogDebug("Installing package directly from directory");
+ m_installMode.command = InstallMode::Command::REINSTALL;
+ m_installMode.extension = InstallMode::ExtensionType::DIR;
m_packagePath = m_argv[2];
AddStep(&WrtInstaller::installStep);
} else {
);
pkgmgrSignal->initialize(m_argc, m_argv);
- m_quiet = pkgmgrSignal->isNoPopupRequired();
- LogDebug("backend m_quiet" << m_quiet);
int reqType = pkgmgrSignal->getRequestedType();
m_packagePath = m_argv[4];
struct stat info;
if (-1 != stat(m_argv[4], &info) && S_ISDIR(info.st_mode)) {
- LogInfo("Installing package directly from directory");
- m_installMode = WRT_INSTALL_MODE_INSTALL_DIRECTORY;
+ LogDebug("Installing package directly from directory");
+ m_installMode.extension = InstallMode::ExtensionType::DIR;
} else {
- LogInfo("Installing from regular location");
- m_installMode = WRT_INSTALL_MODE_INSTALL_WGT;
+ LogDebug("Installing from regular location");
+ m_installMode.extension = InstallMode::ExtensionType::WGT;
}
AddStep(&WrtInstaller::installStep);
break;
case PKGMGR_REQ_UNINSTALL:
- m_name = m_argv[4];
- AddStep(&WrtInstaller::uninstallPkgNameStep);
- break;
+ {
+ m_name = m_argv[4];
+ pkgmgrinfo_pkginfo_h handle = NULL;
+ bool system_app = false; // system app is preloaded and unremovable.
+ bool update = false;
+
+ if (0 == pkgmgrinfo_pkginfo_get_pkginfo(m_name.c_str(), &handle)) {
+ if (0 > pkgmgrinfo_pkginfo_is_system(handle, &system_app)) {
+ LogError("Can't get package information : " << m_name);
+ }
+ if (0 > pkgmgrinfo_pkginfo_is_update(handle, &update)) {
+ LogError("Can't get package information about update : "
+ << m_name);
+ }
+ }
+
+ LogDebug("system app : " << system_app);
+ LogDebug("update : " << update);
+
+ if (system_app && update) {
+ AddStep(&WrtInstaller::removeUpdateStep);
+ } else {
+ AddStep(&WrtInstaller::uninstallPkgNameStep);
+ }
+ break;
+ }
case PKGMGR_REQ_REINSTALL:
m_packagePath = m_argv[4];
- m_installMode = WRT_INSTALL_MODE_REINSTALL;
+ m_installMode.command = InstallMode::Command::REINSTALL;
+ m_installMode.extension = InstallMode::ExtensionType::DIR;
AddStep(&WrtInstaller::installStep);
break;
default:
void WrtInstaller::OnTerminate()
{
LogDebug("Wrt Shutdown now");
- PluginUtils::unlockPluginInstallation(m_installMode ==
- WRT_INSTALL_MODE_INSTALL_PRELOAD);
+ PluginUtils::unlockPluginInstallation(
+ m_installMode.installTime == InstallMode::InstallTime::PRELOAD);
if (m_initialized) {
wrt_installer_shutdown();
}
Quit();
}
+void WrtInstaller::showArguments()
+{
+ fprintf(stderr,
+ "===========================================================\n");
+ fprintf(stderr, "# wrt-installer #\n");
+ fprintf(stderr, "# argc [%d]\n", m_argc);
+ for (int i = 0; i < m_argc; i++) {
+ fprintf(stderr, "# argv[%d] = [%s]\n", i, m_argv[i]);
+ }
+ fprintf(stderr,
+ "===========================================================\n");
+ // for dlog
+ LogDebug("===========================================================");
+ LogDebug("# wrt-installer #");
+ LogDebug("# argc " << m_argc);
+ for (int i = 0; i < m_argc; i++) {
+ LogDebug("# argv[" << i << "] = " << m_argv[i]);
+ }
+ LogDebug("===========================================================");
+
+}
+
void WrtInstaller::OnEventReceived(const WRTInstallerNS::QuitEvent& /*event*/)
{
LogDebug("Quiting");
wrt_install_widget(packagePath ? packagePath.get() : m_packagePath.c_str(),
this, &staticWrtStatusCallback,
- (!m_quiet || m_installByPkgmgr)
+ (m_installByPkgmgr)
? &staticWrtInstallProgressCallback : NULL,
m_installMode,
- m_quiet,
pkgmgrSignalInterface);
}
fprintf(stderr, "Installing plugins ...\n");
if (m_startupPluginInstallation) {
- LogInfo("Plugin installation started because new plugin package found");
- } else if (!PluginUtils::lockPluginInstallation(m_installMode ==
- WRT_INSTALL_MODE_INSTALL_PRELOAD)) {
+ LogDebug("Plugin installation started because new plugin package found");
+ } else if (!PluginUtils::lockPluginInstallation(
+ m_installMode.installTime == InstallMode::InstallTime::PRELOAD))
+ {
LogError("Failed to open plugin installation lock file"
" Plugins are currently installed by other process");
staticWrtPluginInstallationCallback(WRT_INSTALLER_ERROR_PLUGIN_INSTALLATION_FAILED,
return;
}
- LogInfo("Plugin DIRECTORY IS" << PLUGIN_PATH);
+ LogDebug("Plugin DIRECTORY IS" << PLUGIN_PATH);
std::list<std::string> pluginsPaths;
struct dirent libdir;
//set nb of plugins to install
//this value indicate how many callbacks are expected
m_numPluginsToInstall = pluginsPaths.size();
- LogInfo("Plugins to install: " << m_numPluginsToInstall);
+ LogDebug("Plugins to install: " << m_numPluginsToInstall);
m_pluginsPaths = pluginsPaths;
m_totalPlugins = m_numPluginsToInstall;
{
LogDebug("Uninstalling widget ...");
LogDebug("Package name : " << m_name);
- wrt_uninstall_widget(m_name.c_str(), this, &staticWrtStatusCallback,
- (!m_quiet || m_installByPkgmgr)
- ? &staticWrtUninstallProgressCallback : NULL,
- pkgmgrSignalInterface);
+
+ wrt_uninstall_widget(m_name.c_str(), this,
+ &staticWrtStatusCallback,
+ (m_installByPkgmgr)
+ ? &staticWrtUninstallProgressCallback : NULL,
+ pkgmgrSignalInterface);
+}
+
+void WrtInstaller::removeUpdateStep()
+{
+ LogDebug("This web app need to initialize preload app");
+ LogDebug("Package name : " << m_name);
+
+ wrt_uninstall_widget(m_name.c_str(), this,
+ &staticWrtInitializeToPreloadCallback,
+ (m_installByPkgmgr)
+ ? &staticWrtUninstallProgressCallback : NULL,
+ pkgmgrSignalInterface);
+
}
void WrtInstaller::unistallWgtFileStep()
LogDebug("Pkgid from packagePath : " << pkgId);
wrt_uninstall_widget(
DPL::ToUTF8String(*pkgId).c_str(), this, &staticWrtStatusCallback,
- !m_quiet ? &staticWrtUninstallProgressCallback
+ !m_installByPkgmgr ? &staticWrtUninstallProgressCallback
: NULL,
pkgmgrSignalInterface);
} else {
}
}
+void WrtInstaller::staticWrtInitializeToPreloadCallback(std::string tizenId, WrtErrStatus
+ status, void* userdata)
+{
+ WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
+ Assert(This);
+
+ std::string printMsg = "uninstallation";
+
+ if (WRT_SUCCESS != status) {
+ // Failure
+ LogError("Step failed");
+ This->m_returnStatus = 1;
+
+ This->showErrorMsg(status, tizenId, printMsg);
+
+ This->DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>
+ ::PostEvent(WRTInstallerNS::QuitEvent());
+ } else {
+ InstallMode mode;
+ mode.extension = InstallMode::ExtensionType::DIR;
+ mode.installTime = InstallMode::InstallTime::PRELOAD;
+ mode.rootPath = InstallMode::RootPath::RO;
+ std::string packagePath =
+ std::string(WrtDB::GlobalConfig::GetUserPreloadedWidgetPath()) + "/" +
+ This->m_name;
+
+ wrt_install_widget(packagePath.c_str(),
+ This, &staticWrtInitPreloadStatusCallback,
+ NULL,
+ mode,
+ This->pkgmgrSignalInterface);
+ }
+}
+
+void WrtInstaller::staticWrtInitPreloadStatusCallback(std::string tizenId,
+ WrtErrStatus status,
+ void* userdata)
+{
+ WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
+ Assert(This);
+
+ DPL::String resultMsg;
+ std::string printMsg = "initialization";
+
+ if (WRT_SUCCESS != status) {
+ // Failure
+ LogError("Step failed");
+ This->m_returnStatus = status;
+
+ This->showErrorMsg(status, tizenId, printMsg);
+
+ This->DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>
+ ::PostEvent(WRTInstallerNS::QuitEvent());
+ } else {
+ fprintf(stderr,
+ "## wrt-installer : %s %s was successful.\n",
+ tizenId.c_str(),
+ printMsg.c_str());
+ LogDebug("Status succesfull");
+ This->m_returnStatus = 0;
+ resultMsg += L" : " + DPL::FromUTF8String(PKGMGR_END_SUCCESS);
+
+ This->DPL::Event::ControllerEventHandler<WRTInstallerNS::
+ NextStepEvent>
+ ::PostEvent(WRTInstallerNS::NextStepEvent());
+ }
+}
+
void WrtInstaller::staticWrtStatusCallback(std::string tizenId,
WrtErrStatus status,
void* userdata)
if (WRT_SUCCESS != status) {
// Failure
LogError("Step failed");
- This->m_returnStatus = -1;
+ This->m_returnStatus = status;
This->DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>
::PostEvent(WRTInstallerNS::QuitEvent());
- switch (status) {
- case WRT_INSTALLER_ERROR_PACKAGE_NOT_FOUND:
- This->m_returnStatus = 1; //this status is specific
- fprintf(stderr, "## wrt-installer : %s %s has failed - widget package does not exist\n",
- tizenId.c_str(), printMsg.c_str());
- break;
+ This->showErrorMsg(status, tizenId, printMsg);
+ } else {
+ fprintf(stderr,
+ "## wrt-installer : %s %s was successful.\n",
+ tizenId.c_str(),
+ printMsg.c_str());
+ LogDebug("Status succesfull");
+ This->m_returnStatus = 0;
+ resultMsg += L" : " + DPL::FromUTF8String(PKGMGR_END_SUCCESS);
- case WRT_INSTALLER_ERROR_PACKAGE_INVALID:
- This->m_returnStatus = 1; //this status is specific
- fprintf(stderr, "## wrt-installer : %s %s has failed - invalid widget package\n",
- tizenId.c_str(), printMsg.c_str());
- break;
+ if (This->m_installMode.installTime == InstallMode::InstallTime::PRELOAD &&
+ !This->m_packagePath.empty())
+ {
+ LogDebug("This widget is preloaded so it will be removed : "
+ << This->m_packagePath);
+ if (!WrtUtilRemove(This->m_packagePath)) {
+ LogError("Failed to remove " << This->m_packagePath);
+ }
+ }
- case WRT_INSTALLER_ERROR_PACKAGE_LOWER_VERSION:
- This->m_returnStatus = 1; //this status is specific
- fprintf(stderr, "## wrt-installer : %s %s has failed - given"
- " version is lower than existing version\n",
- tizenId.c_str(), printMsg.c_str());
- break;
+ This->DPL::Event::ControllerEventHandler<WRTInstallerNS::
+ NextStepEvent>
+ ::PostEvent(WRTInstallerNS::NextStepEvent());
+ }
+}
- case WRT_INSTALLER_ERROR_MANIFEST_NOT_FOUND:
- This->m_returnStatus = 1; //this status is specific
- fprintf(stderr, "## wrt-installer : %s %s has failed - manifest"
- " file doesn't find in package.\n",
- tizenId.c_str(), printMsg.c_str());
- break;
+void WrtInstaller::showErrorMsg(WrtErrStatus status, std::string tizenId,
+ std::string printMsg)
+{
+ switch (status) {
+ case WRT_INSTALLER_ERROR_PACKAGE_NOT_FOUND:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - widget package does not exist\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
- case WRT_INSTALLER_ERROR_MANIFEST_INVALID:
- This->m_returnStatus = 1; //this status is specific
- fprintf(stderr, "## wrt-installer : %s %s has failed - "
- "invalid manifestx.xml\n",
- tizenId.c_str(), printMsg.c_str());
- break;
+ case WRT_INSTALLER_ERROR_PACKAGE_INVALID:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - invalid widget package\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
- case WRT_INSTALLER_CONFIG_NOT_FOUND:
- This->m_returnStatus = 1; //this status is specific
- fprintf(stderr, "## wrt-installer : %s %s has failed - "
- "config.xml does not exist\n",
- tizenId.c_str(), printMsg.c_str());
- break;
+ case WRT_INSTALLER_ERROR_PACKAGE_LOWER_VERSION:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - given"
+ " version is lower than existing version\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
- case WRT_INSTALLER_ERROR_CONFIG_INVALID:
- This->m_returnStatus = 1; //this status is specific
- fprintf(stderr, "## wrt-installer : %s %s has failed - "
- "invalid config.xml\n",
- tizenId.c_str(), printMsg.c_str());
- break;
+ case WRT_INSTALLER_ERROR_MANIFEST_NOT_FOUND:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - manifest"
+ " file doesn't find in package.\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
- case WRT_INSTALLER_ERROR_SIGNATURE_NOT_FOUND:
- This->m_returnStatus = 1; //this status is specific
- fprintf(stderr, "## wrt-installer : %s %s has failed - "
- "signature doesn't exist in package.\n",
- tizenId.c_str(), printMsg.c_str());
- break;
+ case WRT_INSTALLER_ERROR_MANIFEST_INVALID:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "invalid manifestx.xml\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
- case WRT_INSTALLER_ERROR_SIGNATURE_INVALID:
- This->m_returnStatus = 1; //this status is specific
- fprintf(stderr, "## wrt-installer : %s %s has failed - "
- "invalid signature.\n",
- tizenId.c_str(), printMsg.c_str());
- break;
+ case WRT_INSTALLER_CONFIG_NOT_FOUND:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "config.xml does not exist\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
- case WRT_INSTALLER_ERROR_SIGNATURE_VERIFICATION_FAILED:
- This->m_returnStatus = 1; //this status is specific
- fprintf(stderr, "## wrt-installer : %s %s has failed - "
- "signature verification failed.\n",
- tizenId.c_str(), printMsg.c_str());
- break;
+ case WRT_INSTALLER_ERROR_CONFIG_INVALID:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "invalid config.xml\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
- case WRT_INSTALLER_ERROR_ROOT_CERTIFICATE_NOT_FOUND:
- This->m_returnStatus = 1; //this status is specific
- fprintf(stderr, "## wrt-installer : %s %s has failed - "
- "root certificate could not find.\n",
- tizenId.c_str(), printMsg.c_str());
- break;
+ case WRT_INSTALLER_ERROR_SIGNATURE_NOT_FOUND:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "signature doesn't exist in package.\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
- case WRT_INSTALLER_ERROR_CERTIFICATION_INVAID:
- This->m_returnStatus = 1; //this status is specific
- fprintf(stderr, "## wrt-installer : %s %s has failed - "
- "invalid certification.\n",
- tizenId.c_str(), printMsg.c_str());
- break;
+ case WRT_INSTALLER_ERROR_SIGNATURE_INVALID:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "invalid signature.\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
- case WRT_INSTALLER_ERROR_CERTIFICATE_CHAIN_VERIFICATION_FAILED:
- This->m_returnStatus = 1; //this status is specific
- fprintf(stderr, "## wrt-installer : %s %s has failed - "
- "certificate chain verification failed.\n",
- tizenId.c_str(), printMsg.c_str());
- break;
+ case WRT_INSTALLER_ERROR_SIGNATURE_VERIFICATION_FAILED:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "signature verification failed.\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
- case WRT_INSTALLER_ERROR_CERTIFICATE_EXPIRED:
- This->m_returnStatus = 1; //this status is specific
- fprintf(stderr, "## wrt-installer : %s %s has failed - "
- "certificate expired.\n",
- tizenId.c_str(), printMsg.c_str());
- break;
+ case WRT_INSTALLER_ERROR_ROOT_CERTIFICATE_NOT_FOUND:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "root certificate could not find.\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
- case WRT_INSTALLER_ERROR_INVALID_PRIVILEGE:
- This->m_returnStatus = 1; //this status is specific
- fprintf(stderr, "## wrt-installer : %s %s has failed - "
- "invalid privilege\n",
- tizenId.c_str(), printMsg.c_str());
- break;
+ case WRT_INSTALLER_ERROR_CERTIFICATION_INVAID:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "invalid certification.\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
- case WRT_INSTALLER_ERROR_MENU_ICON_NOT_FOUND:
- This->m_returnStatus = 1; //this status is specific
- fprintf(stderr, "## wrt-installer : %s %s has failed - "
- "menu icon could not find\n",
- tizenId.c_str(), printMsg.c_str());
- break;
+ case WRT_INSTALLER_ERROR_CERTIFICATE_CHAIN_VERIFICATION_FAILED:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "certificate chain verification failed.\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
- case WRT_INSTALLER_ERROR_FATAL_ERROR:
- This->m_returnStatus = 1; //this status is specific
- fprintf(stderr, "## wrt-installer : %s %s has failed - "
- "fatal error\n",
- tizenId.c_str(), printMsg.c_str());
- break;
+ case WRT_INSTALLER_ERROR_CERTIFICATE_EXPIRED:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "certificate expired.\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
- case WRT_INSTALLER_ERROR_OUT_OF_STORAGE:
- This->m_returnStatus = 1; //this status is specific
- fprintf(stderr, "## wrt-installer : %s %s has failed - "
- "out of storage\n",
- tizenId.c_str(), printMsg.c_str());
- break;
+ case WRT_INSTALLER_ERROR_INVALID_PRIVILEGE:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "invalid privilege\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
- case WRT_INSTALLER_ERROR_OUT_OF_MEMORY:
- This->m_returnStatus = 1; //this status is specific
- fprintf(stderr, "## wrt-installer : %s %s has failed - "
- "out of memory\n",
- tizenId.c_str(), printMsg.c_str());
- break;
+ case WRT_INSTALLER_ERROR_PRIVILEGE_LEVEL_VIOLATION:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "privilege level violation\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
- case WRT_INSTALLER_ERROR_PACKAGE_ALREADY_INSTALLED:
- This->m_returnStatus = 1; //this status is specific
- fprintf(stderr, "## wrt-installer : %s %s has failed - "
- "package already installed\n",
- tizenId.c_str(), printMsg.c_str());
- break;
+ case WRT_INSTALLER_ERROR_MENU_ICON_NOT_FOUND:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "menu icon could not find\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
- case WRT_INSTALLER_ERROR_ACE_CHECK_FAILED:
- This->m_returnStatus = 1; //this status is specific
- fprintf(stderr, "## wrt-installer : %s %s has failed - "
- "ace check failure\n",
- tizenId.c_str(), printMsg.c_str());
- break;
+ case WRT_INSTALLER_ERROR_FATAL_ERROR:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "fatal error\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
- case WRT_INSTALLER_ERROR_MANIFEST_CREATE_FAILED:
- This->m_returnStatus = 1; //this status is specific
- fprintf(stderr, "## wrt-installer : %s %s has failed - "
- "to create manifest failed\n",
- tizenId.c_str(), printMsg.c_str());
- break;
+ case WRT_INSTALLER_ERROR_OUT_OF_STORAGE:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "out of storage\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
- case WRT_INSTALLER_ERROR_ENCRYPTION_FAILED:
- This->m_returnStatus = 1; //this status is specific
- fprintf(stderr, "## wrt-installer : %s %s has failed - "
- "encryption of resource failed\n",
- tizenId.c_str(), printMsg.c_str());
- break;
+ case WRT_INSTALLER_ERROR_OUT_OF_MEMORY:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "out of memory\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
- case WRT_INSTALLER_ERROR_INSTALL_OSP_SERVCIE:
- This->m_returnStatus = 1; //this status is specific
- fprintf(stderr, "## wrt-installer : %s %s has failed - "
- "installation of osp service failed\n",
- tizenId.c_str(), printMsg.c_str());
- break;
+ case WRT_INSTALLER_ERROR_ARGUMENT_INVALID:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "invalid argument\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
- case WRT_INSTALLER_ERROR_UNINSTALLATION_FAILED:
- This->m_returnStatus = 1; //this status is specific
- fprintf(stderr, "## wrt-installer : %s %s has failed - "
- "widget uninstallation failed\n",
- tizenId.c_str(), printMsg.c_str());
- break;
+ case WRT_INSTALLER_ERROR_PACKAGE_ALREADY_INSTALLED:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "package already installed\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
+ case WRT_INSTALLER_ERROR_ACE_CHECK_FAILED:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "ace check failure\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
- case WRT_INSTALLER_ERROR_UNKNOWN:
- fprintf(stderr,"## wrt-installer : %s %s has failed - unknown error\n",
- tizenId.c_str(), printMsg.c_str());
- break;
+ case WRT_INSTALLER_ERROR_MANIFEST_CREATE_FAILED:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "to create manifest failed\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
- default:
- break;
- }
- } else {
- fprintf(stderr,
- "## wrt-installer : %s %s was successful.\n",
- tizenId.c_str(),
- printMsg.c_str());
- LogDebug("Status succesfull");
- This->m_returnStatus = 0;
- resultMsg += L" : " + DPL::FromUTF8String(PKGMGR_END_SUCCESS);
+ case WRT_INSTALLER_ERROR_ENCRYPTION_FAILED:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "encryption of resource failed\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
- if (This->m_installMode == WRT_INSTALL_MODE_INSTALL_PRELOAD &&
- !This->m_packagePath.empty()) {
- LogDebug("This widget is preloaded so it will be removed : "
- << This->m_packagePath);
- if (!WrtUtilRemove(This->m_packagePath)) {
- LogError("Failed to remove " << This->m_packagePath);
- }
- }
+ case WRT_INSTALLER_ERROR_INSTALL_OSP_SERVCIE:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "installation of osp service failed\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
- This->DPL::Event::ControllerEventHandler<WRTInstallerNS::
- NextStepEvent>
- ::PostEvent(WRTInstallerNS::NextStepEvent());
+ case WRT_INSTALLER_ERROR_UNINSTALLATION_FAILED:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - "
+ "widget uninstallation failed\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
+
+
+ case WRT_INSTALLER_ERROR_UNKNOWN:
+ fprintf(stderr,"## wrt-installer : %s %s has failed - unknown error\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
+
+ default:
+ break;
}
+
}
void WrtInstaller::staticWrtPluginInstallationCallback(WrtErrStatus status,
//remove installation request
if (!PluginUtils::removeInstallationRequiredFlag()) {
- LogInfo("Failed to remove file initializing plugin installation");
+ LogDebug("Failed to remove file initializing plugin installation");
}
//remove lock file
- if (!PluginUtils::unlockPluginInstallation(This->m_installMode ==
- WRT_INSTALL_MODE_INSTALL_PRELOAD)) {
- LogInfo("Failed to remove installation lock");
+ if (!PluginUtils::unlockPluginInstallation(
+ This->m_installMode.installTime == InstallMode::InstallTime::PRELOAD))
+ {
+ LogDebug("Failed to remove installation lock");
}
This->DPL::Event::ControllerEventHandler<WRTInstallerNS::NextStepEvent>
std::string path = std::string(data->pluginPath);
- LogInfo("Plugin Installation: " << path <<
+ LogDebug("Plugin Installation: " << path <<
" progress: " << percent <<
"description " << description);
}
void* /*userdata*/)
{
//WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
- LogInfo(" progress: " << percent <<
+ LogDebug(" progress: " << percent <<
" description: " << description);
}
void WrtInstaller::staticWrtUninstallProgressCallback(float percent,
void* /*userdata*/)
{
//WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
- LogInfo(" progress: " << percent <<
+ LogDebug(" progress: " << percent <<
" description: " << description);
}
{
LogDebug("Install new plugins");
- if (!PluginUtils::lockPluginInstallation(m_installMode ==
- WRT_INSTALL_MODE_INSTALL_PRELOAD)) {
- LogInfo("Lock NOT created");
+ if (!PluginUtils::lockPluginInstallation(
+ m_installMode.installTime == InstallMode::InstallTime::PRELOAD))
+ {
+ LogDebug("Lock NOT created");
return;
}
if (!PluginUtils::checkPluginInstallationRequired()) {
LogDebug("Plugin installation not required");
- PluginUtils::unlockPluginInstallation(m_installMode ==
- WRT_INSTALL_MODE_INSTALL_PRELOAD);
+ PluginUtils::unlockPluginInstallation(
+ m_installMode.installTime == InstallMode::InstallTime::PRELOAD);
return;
}
const char* ptr = strtok(buf,":");
while (ptr != NULL) {
std::string string = ptr;
+ ptr = strtok (NULL, ":");
size_t pos = string.find('=');
if (pos == std::string::npos) {
continue;
}
result.insert(
CSCConfiguration::dataPair(string.substr(0, pos),
- string.substr(pos+1)));
- ptr = strtok (NULL, ":");
+ string.substr(pos+1)));
}
- return result;
+ free(buf);
+ return result;
}
int main(int argc, char *argv[])
{
UNHANDLED_EXCEPTION_HANDLER_BEGIN
{
+ DPL::Log::LogSystemSingleton::Instance().SetTag("WRT_INSTALLER");
+
// Output on stdout will be flushed after every newline character,
// even if it is redirected to a pipe. This is useful for running
// from a script and parsing output.
LogError("getrlimit is fail!!");
}
- // set evas backend type for emulator
- // popup isn't showed in the emulator,
- // if backend isn't set to SW backend
- if (GlobalSettings::IsEmulator()) {
- if (setenv("ELM_ENGINE", "x11", 1)) {
- LogDebug("Enable backend");
- }
- }
-
WrtInstaller app(argc, argv);
int ret = app.Exec();
LogDebug("App returned: " << ret);