From e35dbb27e26c26e346094b0a8bb1a91a49f5be1f Mon Sep 17 00:00:00 2001 From: Soyoung Kim Date: Mon, 24 Jun 2013 13:49:35 +0900 Subject: [PATCH] change to check condition of preload web app. [Issue#] N/A [Problem] N/A [Cause] N/A [Solution] using package manager api to check preload web app. [SCMRequest] N/A Change-Id: I009bdf89fc051178101380b2c6e68fc9fbf7afe9 --- src/wrt-installer/wrt-installer.cpp | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/src/wrt-installer/wrt-installer.cpp b/src/wrt-installer/wrt-installer.cpp index 4db1ad4..13ddfe8 100644 --- a/src/wrt-installer/wrt-installer.cpp +++ b/src/wrt-installer/wrt-installer.cpp @@ -78,19 +78,6 @@ struct PluginInstallerData void* wrtInstaller; std::string pluginPath; }; - -bool checkInitializeToPreload(std::string pkgid) -{ - std::string RoManifest = "/usr/share/packages/" + pkgid + ".xml"; - std::string RwManifest = "/opt/share/packages/" + pkgid + ".xml"; - - if (access(RwManifest.c_str(), F_OK) == 0 && - access(RoManifest.c_str(), F_OK) == 0) { - LogDebug("This web app need to down update"); - return true; - } - return false; -} } // namespace anonymous WrtInstaller::WrtInstaller(int argc, char **argv) : @@ -529,16 +516,26 @@ void WrtInstaller::uninstallPkgNameStep() { 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); + } + } - if (!checkInitializeToPreload(m_name)) { + if (preload) { + LogDebug("This web app need to initialize preload app"); wrt_uninstall_widget(m_name.c_str(), this, - &staticWrtStatusCallback, + &staticWrtInitializeToPreloadCallback, (m_installByPkgmgr) ? &staticWrtUninstallProgressCallback : NULL, pkgmgrSignalInterface); } else { wrt_uninstall_widget(m_name.c_str(), this, - &staticWrtInitializeToPreloadCallback, + &staticWrtStatusCallback, (m_installByPkgmgr) ? &staticWrtUninstallProgressCallback : NULL, pkgmgrSignalInterface); -- 2.7.4