#include <parser_runner.h>
#include <widget_parser.h>
#include <root_parser.h>
-#include <package-manager.h>
+#include <pkgmgr-info.h>
#include <Elementary.h>
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.command = InstallMode::Command::REINSTALL;
{
LogDebug("Uninstalling widget ...");
LogDebug("Package name : " << m_name);
- pkgmgr_pkginfo_h handle;
- int ret = -1;
- bool preload = false;
- if (0 == pkgmgr_pkginfo_get_pkginfo(m_name.c_str(), &handle)) {
- if (pkgmgr_pkginfo_is_preload(handle, &preload) < 0) {
- LogError("Can't get package information : " << m_name);
- }
- }
+ 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);
- if (preload) {
- LogDebug("This web app need to initialize preload app");
- wrt_uninstall_widget(m_name.c_str(), this,
- &staticWrtInitializeToPreloadCallback,
- (m_installByPkgmgr)
- ? &staticWrtUninstallProgressCallback : NULL,
- pkgmgrSignalInterface);
- } else {
- wrt_uninstall_widget(m_name.c_str(), this,
- &staticWrtStatusCallback,
- (m_installByPkgmgr)
- ? &staticWrtUninstallProgressCallback : NULL,
- pkgmgrSignalInterface);
- }
}
void WrtInstaller::unistallWgtFileStep()