#include "InstallerUtil.h"
-#define OSP_INSTALLER_VERSION "version=[20130521.1]"
+#define OSP_INSTALLER_VERSION "version=[20130522.1]"
#define DIR_BIN L"/bin"
#define DIR_INFO L"/info"
INSTALLER_OPTION_FILELOG_ON = 32,
INSTALLER_OPTION_UPDATE_STDOUT = 64,
INSTALLER_OPTION_CSC = 128,
+ INSTALLER_OPTION_RESET_PRELOADED = 256,
};
{
AppLog("Input param(package) is null in case of cmd, hybrid package.");
}
+
+ if (option & INSTALLER_OPTION_RESET_PRELOADED)
+ {
+ TryReturn(__pContext->__packageId.IsEmpty() == false, INSTALLER_ERROR_INTERNAL_STATE, "packageId is empty.");
+
+ String rootPath(PATH_OPT_USR_APPS);
+ rootPath += L"/";
+ rootPath += __pContext->__packageId;
+
+ AppLog("rootPath[%ls] is deleted.", rootPath.GetPointer());
+ InstallerUtil::Remove(rootPath);
+ }
}
else if (operation == INSTALLER_OPERATION_UNINSTALL)
{
return true;
}
+bool
+InstallerManager::IsUninstallUpdates(const PackageId& packageId, String& originPath)
+{
+ String roXmlPath;
+ roXmlPath.Format(1024, DIR_RO_PACKAGE_SYSTEM_MANIFEST, packageId.GetPointer());
+ if (File::IsFileExist(roXmlPath) == true)
+ {
+ String rwXmlPath;
+ rwXmlPath.Format(1024, DIR_RW_PACKAGE_SYSTEM_MANIFEST, packageId.GetPointer());
+ if (File::IsFileExist(rwXmlPath) == true)
+ {
+ String preloadedAppPath(PATH_USR_APPS);
+ preloadedAppPath += L"/";
+ preloadedAppPath += packageId;
+
+ AppLog("uninstall updates for preloaded app. [%ls]", preloadedAppPath.GetPointer());
+ originPath = preloadedAppPath;
+
+ return true;
+ }
+ }
+ else
+ {
+ //if (CSC_preloaded && update)
+ //{
+ // originPath = cscPackagePath;
+ //}
+ }
+
+ return false;
+}
+
int
InstallerManager::Request(const String& path, InstallerOperation operation, InstallerOption option, void* pPkgmgrInstaller, const String* pOptionalData)
{
bool IsHistoryFileLogOn() const;
static bool SendEvent(InstallationContext* pContext, const Tizen::App::PackageId& packageId, const Tizen::Base::String& key, const Tizen::Base::String& val);
+ static bool IsUninstallUpdates(const Tizen::App::PackageId& packageId, Tizen::Base::String& originPath);
static int Request(const Tizen::Base::String& path, InstallerOperation operation, InstallerOption option, void* pPkgmgrInstaller, const Tizen::Base::String* pOptionalData = null);
static int RequestRecursiveDirectory(const Tizen::Base::String& path, int& errorType);
case PKGMGR_REQ_UNINSTALL:
{
PackageId reqeustPackageId;
-
path.SubString(0, PACKAGE_ID_LENGTH, reqeustPackageId);
-
AppLog("reqeustPackage = %ls", reqeustPackageId.GetPointer());
- ret = InstallerManager::Request(reqeustPackageId, INSTALLER_OPERATION_UNINSTALL, INSTALLER_OPTION_NORMAL, _pi);
+
+ String originPath;
+ if (InstallerManager::IsUninstallUpdates(reqeustPackageId, originPath) == true)
+ {
+ AppLog("originPath = [%ls]", originPath.GetPointer());
+
+ optionalData = reqeustPackageId;
+ errorType = InstallerManager::Request(originPath, INSTALLER_OPERATION_INSTALL, INSTALLER_OPTION_RESET_PRELOADED, _pi, &optionalData);
+ }
+ else
+ {
+ ret = InstallerManager::Request(reqeustPackageId, INSTALLER_OPERATION_UNINSTALL, INSTALLER_OPTION_NORMAL, _pi);
+ }
__osp_installer_report_result(reqeustPackageId, errorType);
}