JobWidgetInstall::JobWidgetInstall(
std::string const &widgetPath,
+ std::string const &tzPkgId,
const Jobs::WidgetInstall::WidgetInstallationStruct &
installerStruct) :
Job(UnknownInstallation),
* @brief Automaticaly sets installation process
*/
JobWidgetInstall(std::string const & widgetPath,
+ std::string const &tzPkgId,
const Jobs::WidgetInstall::WidgetInstallationStruct &installerStruct);
//overrides
}
FOREACH(it, liveboxList) {
- LogDebug("setLiveBoxInfo");
+ _D("setLiveBoxInfo");
LiveBoxInfo liveBox;
DPL::Optional<WrtDB::ConfigParserData::LiveboxInfo> ConfigInfo = *it;
DPL::String appid = m_context.widgetConfig.tzAppid;
DECLARE_JOB_EXCEPTION(Base, InstallOspsvcFailed, ErrorInstallOspServcie)
DECLARE_JOB_EXCEPTION(Base, PrivilegeLevelViolation, ErrorPrivilegeLevelViolation)
DECLARE_JOB_EXCEPTION(Base, NotSupportRDSUpdate, ErrorNotSupportRDSUpdate)
+DECLARE_JOB_EXCEPTION(Base, OutOfStorageFailed, ErrorOutOfStorage)
} //namespace
} //namespace
} //namespace
#include <dpl/abstract_waitable_input_adapter.h>
#include <dpl/wrt-dao-ro/global_config.h>
#include <sys/stat.h>
+#include <sys/statvfs.h>
#include <dlfcn.h>
#include <installer_log.h>
namespace {
const char *const DRM_LIB_PATH = "/usr/lib/libdrm-service-core-tizen.so";
+const size_t SPACE_SIZE = 1024 * 1024;
struct PathAndFilePair
{
ThrowMsg(Exceptions::ZipEmpty, wgtFile);
}
+ checkAvailableSpace(destination);
+
// Set iterator to first file
m_zipIterator = m_zip->begin();
}
}
+void WidgetUnzip::checkAvailableSpace(const std::string &destination)
+{
+ _D("checkAvailableSpace ... ");
+
+ double unCompressedSize = m_zip->GetTotalUncompressedSize();
+ _D("unCompressedSize : %ld", unCompressedSize);
+
+ struct statvfs vfs;
+ if (-1 == statvfs(destination.c_str(), &vfs)) {
+ ThrowMsg(Exceptions::OutOfStorageFailed, "There is no space for installation");
+ }
+
+ double freeSize = (double)vfs.f_bsize * vfs.f_bavail;
+ _D("Space Size : %ld", freeSize);
+
+ if (unCompressedSize + SPACE_SIZE >= freeSize) {
+ ThrowMsg(Exceptions::OutOfStorageFailed, "There is no space for installation");
+ }
+}
+
} //namespace WidgetInstall
} //namespace Jobs
bool decryptDRMPackage(const std::string &source, const std::string
&decryptedSource);
std::string getDecryptedPackage(const std::string &source);
-
+ void checkAvailableSpace(const std::string &destination);
};
} //namespace WidgetInstall
const InstallerControllerEvents::InstallWidgetEvent &event)
{
std::string fileName = event.GetArg0();
- Jobs::WidgetInstall::WidgetInstallationStruct installerStruct = event.GetArg1();
- m_installerLogic.InstallWidget(fileName, installerStruct);
+ std::string pkgId = event.GetArg1();
+ Jobs::WidgetInstall::WidgetInstallationStruct installerStruct = event.GetArg2();
+ m_installerLogic.InstallWidget(fileName, pkgId, installerStruct);
}
void InstallerController::OnEventReceived(
*
* This event holds std::string witch should be path to widget package
*/
-DECLARE_GENERIC_EVENT_2(InstallWidgetEvent,
+DECLARE_GENERIC_EVENT_3(InstallWidgetEvent,
std::string, // zipFileName
+ std::string, // package id
Jobs::WidgetInstall::WidgetInstallationStruct) // installerStruct
/**
// But each Job has different constructor, so creating new Job is specific
Jobs::JobHandle InstallerLogic::InstallWidget(
const std::string & widgetPath,
+ const std::string & pkgId,
const Jobs::WidgetInstall::WidgetInstallationStruct &
installerStruct)
{
_D("New Widget Installation:");
- m_job =
- new Jobs::WidgetInstall::JobWidgetInstall(widgetPath, installerStruct);
-
+ m_job = new Jobs::WidgetInstall::JobWidgetInstall(widgetPath, pkgId, installerStruct);
return AddAndStartJob();
}
Jobs::JobHandle InstallWidget(
const std::string & widgetPath,
+ const std::string & pkgId,
const Jobs::WidgetInstall::WidgetInstallationStruct &
installerStruct);
switch (reqType) {
case PackageManager::PkgmgrSignal::RequestType::INSTALL:
m_packagePath = m_argv[4];
+ m_name = m_argv[6];
+
struct stat info;
if (-1 != stat(m_argv[4], &info) && S_ISDIR(info.st_mode)) {
_D("Installing package directly from directory");
m_packagePath.c_str()));
wrt_install_widget(packagePath ? packagePath.get() : m_packagePath.c_str(),
- this, &staticWrtStatusCallback,
+ m_name.c_str(), this, &staticWrtStatusCallback,
(m_installByPkgmgr)
? &staticWrtInstallProgressCallback : NULL,
m_installMode,
std::string(WrtDB::GlobalConfig::GetUserPreloadedWidgetPath()) + "/" +
This->m_name;
- wrt_install_widget(packagePath.c_str(),
+ wrt_install_widget(packagePath.c_str(), NULL,
This, &staticWrtInitPreloadStatusCallback,
NULL,
mode,
void wrt_install_widget(
const char *path,
+ const char *tzPkgId,
void* userdata,
WrtInstallerStatusCallback status_cb,
WrtProgressCallback progress_cb,
CONTROLLER_POST_EVENT(
Logic::InstallerController,
InstallerControllerEvents::InstallWidgetEvent(
- path, Jobs::WidgetInstall::WidgetInstallationStruct(
+ path, tzPkgId, Jobs::WidgetInstall::WidgetInstallationStruct(
InstallerCallbacksTranslate::installFinishedCallback,
InstallerCallbacksTranslate::installProgressCallback,
new InstallerCallbacksTranslate::StatusCallbackStruct(
void wrt_installer_shutdown(void);
void wrt_install_widget(
const char *path,
+ const char *tzPkgId,
void *user_parameter,
WrtInstallerStatusCallback status_callback,
WrtProgressCallback progress_callback,