#ifndef _INSTALLER_DEFS_H_
#define _INSTALLER_DEFS_H_
-#define OSP_INSTALLER_VERSION "osp-installer version=20130107.2"
+#define OSP_INSTALLER_VERSION "osp-installer version=20130107.3"
#define DIR_BIN L"/bin"
#define DIR_INFO L"/info"
using namespace Tizen::Base::Collection;
using namespace Tizen::Io;
using namespace Tizen::Security::Cert;
+using namespace Tizen::App;
using namespace Tizen::App::Package;
InstallationContext::InstallationContext(void)
return __storage;
}
-const String&
-InstallationContext::GetAppId(void) const
+const PackageId&
+InstallationContext::GetId(void) const
{
- return __appId;
+ return __packageId;
}
void
-InstallationContext::SetAppId(const String& appId)
+InstallationContext::SetId(const PackageId& packageId)
{
- __appId = appId;
+ __packageId = packageId;
}
const String&
#include <app2ext_interface.h>
+#include <FAppTypes.h>
#include <FAppPkg_PackageInfoImpl.h>
#include <FSecCertX509CertificatePath.h>
const Tizen::Base::String& GetWorkingDir(void) const;
void SetWorkingDir(const Tizen::Base::String& workingDir);
- const Tizen::Base::String& GetAppId(void) const;
- void SetAppId(const Tizen::Base::String& appId);
+ const Tizen::App::PackageId& GetId(void) const;
+ void SetId(const Tizen::App::PackageId& packageId);
const Tizen::Base::String& GetAppVersion(void) const;
void SetAppVersion(const Tizen::Base::String& appVersion);
Tizen::Base::Collection::IListT<AppData *>* __pAppDataList;
bool __isSubMode;
+ Tizen::Base::String __subModeAppName;
private:
InstallationContext(const InstallationContext& value);
Tizen::Base::String __temporaryDir;
Tizen::Base::String __installDir;
Tizen::Base::String __workingDir;
- Tizen::Base::String __appId;
+ Tizen::Base::String __packageId;
Tizen::Base::String __appVersion;
Tizen::Base::String __appRootPath;
if (operation == INSTALLER_OPERATION_INSTALL)
{
- pManagerImpl->UnregisterPackageInfo(pContext->GetAppId());
+ pManagerImpl->UnregisterPackageInfo(pContext->GetId());
pManagerImpl->RegisterPackageInfo(*pContext->GetPackageInfoImpl());
}
else
{
- pManagerImpl->UnregisterPackageInfo(pContext->GetAppId());
+ pManagerImpl->UnregisterPackageInfo(pContext->GetId());
}
AppLogTag(OSP_INSTALLER, "Installer::OnRegister() - END");
AppLogTag(OSP_INSTALLER, "------------------------------------------");
}
String newPath = SLP_FONT_PATH;
- newPath += L"/" + pContext->GetAppId();
+ newPath += L"/" + pContext->GetId();
Directory::Create(newPath, false);
InstallerUtil::ChangeMode(newPath, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
//if (pContext->IsPreloaded() == true)
//{
- // xmlPath.Format(1024, DIR_RO_PACKAGE_SYSTEM_MANIFEST, pContext->GetAppId().GetPointer());
+ // xmlPath.Format(1024, DIR_RO_PACKAGE_SYSTEM_MANIFEST, pContext->GetId().GetPointer());
//}
//else
//{
- xmlPath.Format(1024, DIR_RW_PACKAGE_SYSTEM_MANIFEST, pContext->GetAppId().GetPointer());
+ xmlPath.Format(1024, DIR_RW_PACKAGE_SYSTEM_MANIFEST, pContext->GetId().GetPointer());
//}
pXmlPath = _StringConverter::CopyToCharArrayN(xmlPath);
//if (pContext->IsPreloaded() == true)
//{
- // xmlPath.Format(1024, DIR_RO_PACKAGE_SYSTEM_MANIFEST, pContext->GetAppId().GetPointer());
+ // xmlPath.Format(1024, DIR_RO_PACKAGE_SYSTEM_MANIFEST, pContext->GetId().GetPointer());
//}
//else
//{
- xmlPath.Format(1024, DIR_RW_PACKAGE_SYSTEM_MANIFEST, pContext->GetAppId().GetPointer());
+ xmlPath.Format(1024, DIR_RW_PACKAGE_SYSTEM_MANIFEST, pContext->GetId().GetPointer());
//}
pXmlPath = _StringConverter::CopyToCharArrayN(xmlPath);
int res = 0;
bool result = true;
pkgmgr_instcertinfo_h handle = null;
- String appId = pContext->GetAppId();
+ String appId = pContext->GetId();
X509CertificatePath* pAuthorCertPath = pContext->GetAuthorCertPath();
X509CertificatePath* pDistributorCertPath = pContext->GetDistributorCertPath();
AppLogTag(OSP_INSTALLER, "UnregisterCertInfo - START");
int res = 0;
bool result = true;
- String appId = pContext->GetAppId();
+ String appId = pContext->GetId();
char* pAppId = _StringConverter::CopyToCharArrayN(appId);
TryCatch(pAppId, result = false, "[osp-installer] pAppId is null");
app2ext_handle* pHandle = pContext->GetApp2ExtHandle();
if (pHandle)
{
- String appId = pContext->GetAppId();
+ String appId = pContext->GetId();
std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
TryReturn(pAppId, false, "[osp-installer] pAppId is null");
app2ext_handle* pHandle = pContext->GetApp2ExtHandle();
if (pHandle)
{
- String appId = pContext->GetAppId();
+ String appId = pContext->GetId();
std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
TryReturn(pAppId, false, "[osp-installer] pAppId is null");
using namespace Tizen::Base::Utility;
using namespace Tizen::Base::Collection;
using namespace Tizen::Io;
+using namespace Tizen::App;
using namespace Tizen::App::Package;
const int BUFSIZE = 512;
AppLogTag(OSP_INSTALLER, "operation is INSTALLER_OPERATION_UNINSTALL");
__pContext->SetCurrentInstallationStep(INSTALLER_STEP_INIT_UNINSTALL);
- __pContext->SetAppId(path);
+ __pContext->SetId(path);
}
__pContext->SetInstallerOperation(operation);
InstallationContext* pContext = null;
InstallerError errorType = INSTALLER_ERROR_NONE;
InstallerManager* pInstallManager = null;
- String appId;
+ PackageId packageId;
AppLogTag(OSP_INSTALLER, "------------------------------------------");
AppLogTag(OSP_INSTALLER, "InstallerManager::Request");
pContext = pInstallManager->GetContext();
TryCatch(pContext, errorType = INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] pContext is null.");
- appId = pContext->GetAppId();
- SetAppId(appId);
+ packageId = pContext->GetId();
+ SetId(packageId);
CATCH:
if (File::IsFileExist(DIR_OSP_APPLICATIONS_TEMP) == true)
AppLogTag(OSP_INSTALLER, "------------------------------------------");
AppLogTag(OSP_INSTALLER, "PackageInfo");
AppLogTag(OSP_INSTALLER, "------------------------------------------");
- AppLogTag(OSP_INSTALLER, "# id = [%S]", pPackageInfoImpl->GetAppId().GetPointer());
+ AppLogTag(OSP_INSTALLER, "# id = [%S]", pPackageInfoImpl->GetId().GetPointer());
AppLogTag(OSP_INSTALLER, "# version = [%S]", pPackageInfoImpl->GetAppVersion().GetPointer());
AppLogTag(OSP_INSTALLER, "# secret = [%S]", pPackageInfoImpl->GetAppSecret().GetPointer());
AppLogTag(OSP_INSTALLER, "# name = [%S]", pPackageInfoImpl->GetAppName().GetPointer());
void
InstallerManager::PrintResult(void)
{
- String appId = GetAppId();
+ String appId = GetId();
int errorType = GetErrorType();
InstallerOperation operation = GetInstallerOperation();
fprintf(stderr, " # result = [%s]\n", (errorType == 0)?"Success":"Failure");
}
-const String&
-InstallerManager::GetAppId(void) const
+const PackageId&
+InstallerManager::GetId(void) const
{
- return __appId;
+ return __packageId;
}
void
-InstallerManager::SetAppId(const String& appId)
+InstallerManager::SetId(const PackageId& packageId)
{
- __appId = appId;
+ __packageId = packageId;
}
int
void PrintPackageInfo(const char* appId);
void PrintResult(void);
- const Tizen::Base::String& GetAppId(void) const;
- void SetAppId(const Tizen::Base::String& appId);
+ const Tizen::App::PackageId& GetId(void) const;
+ void SetId(const Tizen::App::PackageId& appId);
int GetErrorType(void) const;
void SetErrorType(int errorType);
InstallationContext* __pContext;
Installer* __pInstaller;
- Tizen::Base::String __appId;
+ Tizen::App::PackageId __packageId;
int __errorType;
InstallerOperation __operation;
// appRoot/bin
destPath = appRootPath + DIR_BIN;
- InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE | PERM_EXECUTE);
+ InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE | PERM_EXECUTE, false);
// appRoot/info
destPath = appRootPath + DIR_INFO;
- InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE);
+ InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, false);
// appRoot/res
destPath = appRootPath + DIR_RES;
- InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE);
+ InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, false);
// appRoot/lib
destPath = appRootPath + DIR_LIB;
- InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE | PERM_EXECUTE);
+ InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE | PERM_EXECUTE, false);
// appRoot/shared
destPath = appRootPath + DIR_SHARED;
r = Directory::Create(destPath, false);
TryReturn(!IsFailed(r), INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] Directory::Create() failed");
}
- InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE);
+ InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, false);
destPath = appRootPath + DIR_SHARED_RES;
if (File::IsFileExist(destPath) == false)
String iconPath = appRootPath + DIR_ICONS;
InstallerUtil::CreateSymlink(iconPath, destPath);
}
- InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE);
+ InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, false);
// appRoot/contents
destPath = appRootPath + DIR_CONTENTS;
- InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE);
+ InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, false);
// appRoot/setting
destPath = appRootPath + DIR_SETTING;
InstallerUtil::Remove(settingXmlPath);
InstallerUtil::CreateSymlink(srcPath, settingXmlPath);
- InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE | PERM_WRITE);
+ InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE | PERM_WRITE, false);
}
// appRoot/data
}
InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, true);
- String appId = pContext->GetAppId();
+ String appId = pContext->GetId();
String apiVersion = pPackageInfoImpl->GetAppApiVersion();
AppLogTag(OSP_INSTALLER, "------------------------------------------");
pPackageInfoImpl = __pContext->GetPackageInfoImpl();
TryReturn(pPackageInfoImpl, error = INSTALLER_ERROR_INVALID_MANIFEST, "[osp-installer] pPackageInfoImpl is null");
- __pContext->SetAppId(pPackageInfoImpl->GetAppId());
+ __pContext->SetId(pPackageInfoImpl->GetId());
GoNextState();
const ArrayList* pPrivilegeList = __pContext->GetPrivilegeList();
RootCertificateType certType = __pContext->GetRootCertType();
_PackageInfoImpl* pPackageInfoImpl = __pContext->GetPackageInfoImpl();
- String appId = pPackageInfoImpl->GetAppId();
+ String appId = pPackageInfoImpl->GetId();
int apiVisibility = GetApiVisibility(certType);
AppLogTag(OSP_INSTALLER, "AppId = [%ls], CertType = [%d], ApiVisibility = [%d]", appId.GetPointer(), certType, apiVisibility);
UninstallStep::OnStateGetPackageInfo(void)
{
InstallerError error = INSTALLER_ERROR_NONE;
- String appId = __pContext->GetAppId();
+ String appId = __pContext->GetId();
_PackageInfoImpl* pPackageInfoImpl = __pContext->GetPackageInfoImpl();
TryReturn(pPackageInfoImpl, INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] pPackageInfoImpl is null");
installPath += PACKAGE_NAME_PREFIX_ORG;
}
- installPath += __pContext->GetAppId();
+ installPath += __pContext->GetId();
result r = E_SUCCESS;
FileUnzipper unzipper;
if (__pContext->GetInstallationStorage() == InstallationContext::INSTALLATION_STORAGE_EXTERNAL)
{
int res = 0;
- String appId = __pContext->GetAppId();
+ String appId = __pContext->GetId();
std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
TryReturn(pAppId, INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] pAppId is null");
}
bool
-InstallerUtil::ChangeDirectoryPermission(const String& filePath, int mode, bool isOwnerChanged)
+InstallerUtil::ChangeDirectoryPermission(const String& filePath, int mode, bool appOwner)
{
result r = E_SUCCESS;
bool res = false;
- AppLogTag(OSP_INSTALLER, "+ ChangeDirectoryPermission(): path=[%ls], mode=[%04o], isOwnerChanged=[%s]",
- filePath.GetPointer(), mode, isOwnerChanged?"true":"false");
+ AppLogTag(OSP_INSTALLER, "+ ChangeDirectoryPermission(): path=[%ls], mode=[%04o], appOwner=[%s]",
+ filePath.GetPointer(), mode, appOwner?"true":"false");
res = File::IsFileExist(filePath);
if (res == false)
if (entryName == L".")
{
- if (isOwnerChanged == true)
+ if (appOwner == true)
{
InstallerUtil::ChangeOwner(entryDir);
}
if (entry.IsDirectory() == false)
{
- if (isOwnerChanged == true)
+ if (appOwner == true)
{
InstallerUtil::ChangeOwner(entryDir);
}
}
else
{
- ChangeDirectoryPermission(entryDir, mode, isOwnerChanged);
- if (isOwnerChanged == true)
+ ChangeDirectoryPermission(entryDir, mode, appOwner);
+ if (appOwner == true)
{
InstallerUtil::ChangeOwner(entryDir);
}
static bool CreateSymlink(const Tizen::Base::String& oldPath, const Tizen::Base::String& newPath);
static bool ChangeMode(const Tizen::Base::String& filePath, int mode);
static bool ChangeOwner(const Tizen::Base::String& filePath);
- static bool ChangeDirectoryPermission(const Tizen::Base::String& filePath, int mode, bool isOwnerChanged=false);
+ static bool ChangeDirectoryPermission(const Tizen::Base::String& filePath, int mode, bool appOwner);
static bool IsDrmFile(const Tizen::Base::String& path);
static bool DecryptPackage(const Tizen::Base::String& packagePath);
//if (preload == true)
//{
- // xmlPath.Format(1024, DIR_RO_PACKAGE_SYSTEM_MANIFEST, __pContext->GetAppId().GetPointer());
+ // xmlPath.Format(1024, DIR_RO_PACKAGE_SYSTEM_MANIFEST, __pContext->GetId().GetPointer());
// location = L"internal-only";
//}
//else
//{
- xmlPath.Format(1024, DIR_RW_PACKAGE_SYSTEM_MANIFEST, __pContext->GetAppId().GetPointer());
+ xmlPath.Format(1024, DIR_RW_PACKAGE_SYSTEM_MANIFEST, __pContext->GetId().GetPointer());
location = L"auto";
//}
- package = __pContext->GetAppId();
+ package = __pContext->GetId();
__pWriter->Construct(xmlPath);
_PackageInfoImpl *pPackageInfoImpl = null;
pPackageInfoImpl = __pContext->GetPackageInfoImpl();
+ // SUB_MODE_APPCONTROL_NAME -> AppName
+ String subBinaryPath;
+ subBinaryPath.Format(1024, L"%ls%ls/%ls", pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_BIN, SUB_MODE_APPCONTROL_NAME);
+
String binaryPath;
- binaryPath.Format(1024, L"%ls%ls/%ls", pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_BIN, SUB_MODE_APPCONTROL_NAME);
+ binaryPath.Format(1024, L"%ls%ls/%ls", pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_BIN, __pContext->__subModeAppName.GetPointer());
- String binaryExecPath = binaryPath + ".exe";
+ if (File::IsFileExist(subBinaryPath) == true)
+ {
+ InstallerUtil::Remove(subBinaryPath);
+ }
+ InstallerUtil::CreateSymlink(binaryPath, subBinaryPath);
- InstallerUtil::Copy(UIAPP_LOADER_PATH, binaryExecPath);
- InstallerUtil::ChangeMode(binaryExecPath, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
+ // SUB_MODE_APPCONTROL_NAME.exe -> AppName.exe
+ String subBinaryExecPath = subBinaryPath + ".exe";
+ String binaryExecPath = binaryPath + ".exe";
- if (File::IsFileExist(binaryPath) == true)
+ if (File::IsFileExist(subBinaryExecPath) == true)
{
- InstallerUtil::Remove(binaryPath);
+ InstallerUtil::Remove(subBinaryExecPath);
}
-
- InstallerUtil::CreateSymlink(binaryExecPath, binaryPath);
+ InstallerUtil::CreateSymlink(binaryExecPath, subBinaryExecPath);
IListT<AppData*>* pAppDataList = __pContext->__pAppDataList;
TryReturn(pAppDataList, false, "[osp-installer] pAppDataList is null");
pAppDataList->GetAt(index, pAppData);
TryReturn(pAppData, false, "[osp-installer] pAppData is null");
- PackageId packageId = __pContext->GetAppId();
+ PackageId packageId = __pContext->GetId();
AppId appId = packageId + L"." + SUB_MODE_APPCONTROL_NAME;
__pWriter->StartElement("ui-application");
__pWriter->WriteAttribute("appid", appId);
- __pWriter->WriteAttribute("exec", binaryPath);
+ __pWriter->WriteAttribute("exec", subBinaryPath);
__pWriter->WriteAttribute("nodisplay", "true");
__pWriter->WriteAttribute("taskmanage", "false");
__pWriter->WriteAttribute("multiple", "true");
result r = E_SUCCESS;
String privileges;
String hmacPrivileges;
- String appId = __pPackageInfoImpl->GetAppId();
+ String appId = __pPackageInfoImpl->GetId();
r = PrivilegeHandler::GenerateCipherPrivilege(appId, *__pPrivilegeList, privileges, hmacPrivileges);
if (IsFailed(r))
{
bool
ManifestHandler::OnUiAppEndElement(void)
{
- __pPackageInfoImpl->AddAppInfo(*__pPackageAppInfoImpl);
- __pPackageAppInfoImpl = null;
-
- __isDefaultName = false;
-
if (__pContext->__isSubMode == true)
{
__pSubModeAppControlDataList = __pAppData->__pAppControlDataList;
__pAppData->__pAppControlDataList = null;
+ __pContext->__subModeAppName = __pPackageAppInfoImpl->GetName();
}
+ __pPackageInfoImpl->AddAppInfo(*__pPackageAppInfoImpl);
+ __pPackageAppInfoImpl = null;
+
+ __isDefaultName = false;
+
__pContext->__pAppDataList->Add(__pAppData);
__pAppData = null;
bool
ManifestHandler::OnServiceAppEndElement(void)
{
- __pPackageInfoImpl->AddAppInfo(*__pPackageAppInfoImpl);
- __pPackageAppInfoImpl = null;
-
- __isDefaultName = false;
-
if (__pContext->__isSubMode == true)
{
__pSubModeAppControlDataList = __pAppData->__pAppControlDataList;
__pAppData->__pAppControlDataList = null;
+ __pContext->__subModeAppName = __pPackageAppInfoImpl->GetName();
}
+ __pPackageInfoImpl->AddAppInfo(*__pPackageAppInfoImpl);
+ __pPackageAppInfoImpl = null;
+
+ __isDefaultName = false;
+
__pContext->__pAppDataList->Add(__pAppData);
__pAppData = null;
ManifestHandler::OnIdValue(const char *pCharacters)
{
AppLogTag(OSP_INSTALLER, "<Id>%s</Id>", pCharacters);
- __pPackageInfoImpl->SetAppId(pCharacters);
+ __pPackageInfoImpl->SetId(pCharacters);
return true;
}
}
String appId;
- appId.Format(1024, PACKAGE_NAME_RULE, __pPackageInfoImpl->GetAppId().GetPointer(), pName);
+ appId.Format(1024, PACKAGE_NAME_RULE, __pPackageInfoImpl->GetId().GetPointer(), pName);
__pPackageAppInfoImpl->SetPackageName(appId);
AppLogTag(OSP_INSTALLER, " - appId=%ls", appId.GetPointer());
case PKGMGR_REQ_INSTALL:
{
errorType = manager.Request(path, INSTALLER_OPERATION_INSTALL, REQUESTER_TYPE_NORMAL);
- appId = manager.GetAppId();
+ appId = manager.GetId();
if (_pi != 0)
{
char resultBuf[128] = {0};
AppLogTag(OSP_INSTALLER, "requestAppId = %ls", requestAppId.GetPointer());
ret = manager.Request(requestAppId, INSTALLER_OPERATION_UNINSTALL, REQUESTER_TYPE_NORMAL);
- appId = manager.GetAppId();
+ appId = manager.GetId();
if (_pi != 0)
{