X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fjobs%2Fwidget_install%2Ftask_install_ospsvc.cpp;h=0a3e2f62fcaa5bfdc0aea484dc65e9a10dcecdf7;hb=253c98d93cddcecefe06429babf6ee11d323f970;hp=0a26435176fc5d059d732db238a5f79c668941bc;hpb=b2d5152315e2ed6aff81d5cf29f66cf8e3029bb9;p=framework%2Fweb%2Fwrt-installer.git diff --git a/src/jobs/widget_install/task_install_ospsvc.cpp b/src/jobs/widget_install/task_install_ospsvc.cpp index 0a26435..0a3e2f6 100644 --- a/src/jobs/widget_install/task_install_ospsvc.cpp +++ b/src/jobs/widget_install/task_install_ospsvc.cpp @@ -24,10 +24,14 @@ #include #include +#include +#include +#include #include #include #include #include +#include #include #include @@ -37,7 +41,7 @@ using namespace WrtDB; namespace { const int MAX_BUF_SIZE = 128; -const char* OSP_INSTALL_STR = "/usr/etc/package-manager/backend/oap -iv "; +const char* OSP_INSTALL_STR = "/usr/etc/package-manager/backend/tpk -iv "; } namespace Jobs { @@ -46,16 +50,18 @@ TaskInstallOspsvc::TaskInstallOspsvc(InstallerContext& context) : DPL::TaskDecl(this), m_context(context) { + AddStep(&TaskInstallOspsvc::StartStep); AddStep(&TaskInstallOspsvc::StepInstallOspService); + AddStep(&TaskInstallOspsvc::EndStep); } void TaskInstallOspsvc::StepInstallOspService() { - LogInfo("Step: installation for osp service"); + LogDebug("Step: installation for osp service"); std::ostringstream commStr; - commStr << OSP_INSTALL_STR << GlobalConfig::GetUserInstalledWidgetPath(); - commStr << "/" << m_context.widgetConfig.pkgname; + commStr << OSP_INSTALL_STR << BashUtils::escape_arg( + m_context.locations->getPackageInstallationDir()); //commStr << " 2>&1"; LogDebug("osp install command : " << commStr.str()); @@ -64,23 +70,43 @@ void TaskInstallOspsvc::StepInstallOspService() fd = popen(commStr.str().c_str(), "r"); if (NULL == fd) { LogError("Failed to installtion osp service"); - ThrowMsg(Exceptions::InstallOspsvcFailed, "Error occurs during\ + ThrowMsg(Exceptions::InstallOspsvcFailed, + "Error occurs during\ + install osp service"); + } + + if (fgets(readBuf, MAX_BUF_SIZE, fd) == NULL) + { + LogError("Failed to installtion osp service.\ + Inability of reading file."); + ThrowMsg(Exceptions::InstallOspsvcFailed, + "Error occurs during\ install osp service"); } - fgets(readBuf, MAX_BUF_SIZE, fd); LogDebug("return value : " << readBuf); int result = atoi(readBuf); if (0 != result) { - ThrowMsg(Exceptions::InstallOspsvcFailed, "Error occurs during\ + ThrowMsg(Exceptions::InstallOspsvcFailed, + "Error occurs during\ install osp service"); } pclose(fd); +} +void TaskInstallOspsvc::StartStep() +{ + LogDebug("--------- : START ----------"); +} + +void TaskInstallOspsvc::EndStep() +{ m_context.job->UpdateProgress( InstallerContext::INSTALL_INSTALL_OSPSVC, "Installed Osp servcie"); + + LogDebug("--------- : END ----------"); } } //namespace WidgetInstall } //namespace Jobs