#include <parser_runner.h>
#include <widget_parser.h>
#include <root_parser.h>
-#include <pkg-manager/pkgmgr_signal.h>
+
+
#define NOFILE_CNT_FOR_INSTALLER 9999
m_installByPkgmgr(false),
m_quiet(true),
m_popup(NULL),
- m_startupPluginInstallation(false)
+ m_startupPluginInstallation(false),
+ m_preloadWidget(false)
{
Touch();
LogDebug("App Created");
std::string arg = m_argv[0];
+ pkgmgrSignalInterface = std::static_pointer_cast<PackageManager::IPkgmgrSignal>(
+ std::shared_ptr<PackageManager::PkgmgrSignalDummy>(
+ new PackageManager::PkgmgrSignalDummy()
+ )
+ );
+
if (arg.empty()) {
return showHelpAndQuit();
}
return showHelpAndQuit();
}
+ struct stat info;
+ if (-1 != stat(m_argv[2], &info) && S_ISDIR(info.st_mode)) {
+ LogInfo("Installing package directly from directory");
+ m_installPolicy = WRT_WIM_POLICY_DIRECTORY_FORCE_INSTALL;
+ }
+ else
+ {
+ LogInfo("Installing from regular location");
+ m_installPolicy = WRT_WIM_POLICY_WAC;
+ }
m_packagePath = m_argv[2];
- m_installPolicy = WRT_WIM_POLICY_WAC;
AddStep(&WrtInstaller::installStep);
} else if (arg == "-if" || arg == "--install-force") {
if (m_argc != 3) {
m_packagePath = m_argv[2];
m_installPolicy = WRT_WIM_POLICY_FORCE_INSTALL;
AddStep(&WrtInstaller::installStep);
+ } else if (arg == "-il" || arg == "--install-preload") {
+ if (m_argc != 3) {
+ return showHelpAndQuit();
+ }
+
+ m_packagePath = m_argv[2];
+ m_preloadWidget = true;
+ m_installPolicy = WRT_WIM_POLICY_WAC;
+ AddStep(&WrtInstaller::installStep);
} else if (arg == "-un" || arg == "--uninstall-name") {
if (m_argc != 3) {
return showHelpAndQuit();
using namespace PackageManager;
m_installByPkgmgr = true;
- PkgmgrSignalSingleton::Instance().initialize(m_argc, m_argv);
- m_quiet = PkgmgrSignalSingleton::Instance().isNoPopupRequired();
+ auto pkgmgrSignal = std::shared_ptr<PackageManager::PkgmgrSignal>(
+ new PackageManager::PkgmgrSignal()
+ );
+
+ pkgmgrSignal->initialize(m_argc, m_argv);
+ m_quiet = pkgmgrSignal->isNoPopupRequired();
LogDebug("backend m_quiet"<<m_quiet);
- int reqType = PkgmgrSignalSingleton::Instance().getRequestedType();
+ int reqType = pkgmgrSignal->getRequestedType();
+ pkgmgrSignalInterface =
+ std::static_pointer_cast<PackageManager::IPkgmgrSignal>(pkgmgrSignal);
switch (reqType) {
case PKGMGR_REQ_INSTALL:
m_packagePath = m_argv[4];
- m_installPolicy = WRT_WIM_POLICY_WAC;
+ struct stat info;
+ if (-1 != stat(m_argv[4], &info) && S_ISDIR(info.st_mode)) {
+ LogInfo("Installing package directly from directory");
+ m_installPolicy = WRT_WIM_POLICY_DIRECTORY_FORCE_INSTALL;
+ }
+ else
+ {
+ LogInfo("Installing from regular location");
+ m_installPolicy = WRT_WIM_POLICY_WAC;
+ }
AddStep(&WrtInstaller::installStep);
break;
case PKGMGR_REQ_UNINSTALL:
(!m_quiet || m_installByPkgmgr)
? &staticWrtInstallProgressCallback : NULL,
m_installPolicy,
- m_quiet);
+ m_quiet,
+ m_preloadWidget,
+ pkgmgrSignalInterface);
}
void WrtInstaller::installPluginsStep()
LogDebug("Package name : " << m_name);
wrt_uninstall_widget(m_name.c_str(), this, &staticWrtStatusCallback,
(!m_quiet || m_installByPkgmgr)
- ? &staticWrtUninstallProgressCallback : NULL);
+ ? &staticWrtUninstallProgressCallback : NULL,
+ pkgmgrSignalInterface);
}
void WrtInstaller::uninstallGuidStep()
if (status == WRT_SUCCESS) {
LogDebug("Guid : " << m_name);
wrt_uninstall_widget(pkgname.c_str(), this, &staticWrtStatusCallback,
- !m_quiet ? &staticWrtUninstallProgressCallback : NULL);
+ !m_quiet ? &staticWrtUninstallProgressCallback : NULL,
+ pkgmgrSignalInterface);
} else {
printf("failed: can not uninstall widget\n");
LogError("Fail to uninstalling widget... ");
if (status == WRT_SUCCESS) {
LogDebug("Pkgname from packagePath : " << pkgname);
wrt_uninstall_widget(pkgname.c_str(), this, &staticWrtStatusCallback,
- !m_quiet ? &staticWrtUninstallProgressCallback : NULL);
+ !m_quiet ? &staticWrtUninstallProgressCallback : NULL,
+ pkgmgrSignalInterface);
} else {
LogError("Fail to uninstalling widget... ");
m_returnStatus = -1;
int main(int argc, char *argv[])
{
- // 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.
- // (Standard behavior of stdlib is to use full buffering when
- // redirected to a pipe, which means even after an end of line
- // the output may not be flushed).
- setlinebuf(stdout);
-
- // Check and re-set the file open limitation
- struct rlimit rlim;
- if (getrlimit(RLIMIT_NOFILE, &rlim) != -1) {
- LogDebug("RLIMIT_NOFILE sft(" << rlim.rlim_cur << ")" );
- LogDebug("RLIMIT_NOFILE hrd(" << rlim.rlim_max << ")" );
-
- if (rlim.rlim_cur < NOFILE_CNT_FOR_INSTALLER) {
- rlim.rlim_cur = NOFILE_CNT_FOR_INSTALLER;
- rlim.rlim_max = NOFILE_CNT_FOR_INSTALLER;
- if (setrlimit(RLIMIT_NOFILE, &rlim) == -1) {
- LogError("setrlimit is fail!!");
+ UNHANDLED_EXCEPTION_HANDLER_BEGIN
+ {
+ // 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.
+ // (Standard behavior of stdlib is to use full buffering when
+ // redirected to a pipe, which means even after an end of line
+ // the output may not be flushed).
+ setlinebuf(stdout);
+
+ // Check and re-set the file open limitation
+ struct rlimit rlim;
+ if (getrlimit(RLIMIT_NOFILE, &rlim) != -1) {
+ LogDebug("RLIMIT_NOFILE sft(" << rlim.rlim_cur << ")" );
+ LogDebug("RLIMIT_NOFILE hrd(" << rlim.rlim_max << ")" );
+
+ if (rlim.rlim_cur < NOFILE_CNT_FOR_INSTALLER) {
+ rlim.rlim_cur = NOFILE_CNT_FOR_INSTALLER;
+ rlim.rlim_max = NOFILE_CNT_FOR_INSTALLER;
+ if (setrlimit(RLIMIT_NOFILE, &rlim) == -1) {
+ LogError("setrlimit is fail!!");
+ }
}
+ } else {
+ LogError("getrlimit is fail!!");
}
- } else {
- 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");
+ // 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);
- ret = app.getReturnStatus();
- LogDebug("WrtInstaller returned: " << ret);
- return ret;
+ WrtInstaller app(argc, argv);
+ int ret = app.Exec();
+ LogDebug("App returned: " << ret);
+ ret = app.getReturnStatus();
+ LogDebug("WrtInstaller returned: " << ret);
+ return ret;
+ }
+ UNHANDLED_EXCEPTION_HANDLER_END
}