#ifndef _INSTALLER_DEFS_H_
#define _INSTALLER_DEFS_H_
-#define OSP_INSTALLER_VERSION "osp-installer version=20130109.1"
+#define OSP_INSTALLER_VERSION "osp-installer version = 20130111.1"
#define DIR_BIN L"/bin"
#define DIR_INFO L"/info"
enum InstallerError
{
- INSTALLER_ERROR_NONE,
- INSTALLER_ERROR_MEMORY,
- INSTALLER_ERROR_INTERNAL_STATE,
- INSTALLER_ERROR_DATABASE,
- INSTALLER_ERROR_APP_COUNT_MAX,
- INSTALLER_ERROR_OUT_OF_STORAGE,
- INSTALLER_ERROR_INVALID_PACKAGE,
- INSTALLER_ERROR_INVALID_MANIFEST,
- INSTALLER_ERROR_INVALID_APPLICATION,
- INSTALLER_ERROR_INVALID_SIGNATURE,
- INSTALLER_ERROR_ICON_MAINMENU,
- INSTALLER_ERROR_ICON_SETTING,
- INSTALLER_ERROR_ICON_TICKER,
- INSTALLER_ERROR_ICON_QUICKPANEL,
- INSTALLER_ERROR_ICON_LAUNCHIMAGE,
- INSTALLER_ERROR_PRIVILEGE,
- INSTALLER_ERROR_USER_CANCEL,
- INSTALLER_ERROR_CERT_CHAIN,
- INSTALLER_ERROR_CERT_REVOKED,
- INSTALLER_ERROR_CERT_ROOT,
- INSTALLER_ERROR_DRM,
- INSTALLER_ERROR_INTEGRITY_FAILED,
- INSTALLER_ERROR_UNMOUNT_FAILED
+ INSTALLER_ERROR_NONE = 0,
+ INSTALLER_ERROR_PACKAGE_NOT_FOUND = 1,
+ INSTALLER_ERROR_PACKAGE_INVALID = 2,
+ INSTALLER_ERROR_PACKAGE_LOWER_VERSION = 3,
+ INSTALLER_ERROR_EXECUTABLE_NOT_FOUND = 4,
+ INSTALLER_ERROR_MANIFEST_NOT_FOUND = 11,
+ INSTALLER_ERROR_MANIFEST_INVALID = 12,
+ INSTALLER_ERROR_SIGNATURE_NOT_FOUND = 21,
+ INSTALLER_ERROR_SIGNATURE_INVALID = 22,
+ INSTALLER_ERROR_SIGNATURE_VERIFICATION_FAILED = 23,
+ INSTALLER_ERROR_ROOT_CERTIFICATE_NOT_FOUND = 31,
+ INSTALLER_ERROR_CERTIFICATE_INVALID = 32,
+ INSTALLER_ERROR_CERTIFICATE_CHAIN_VERIFICATION_FAILED = 33,
+ INSTALLER_ERROR_CERTIFICATE_EXPIRED = 34,
+ INSTALLER_ERROR_PRIVILEGE_INVALID = 41,
+ INSTALLER_ERROR_MENU_ICON_NOT_FOUND = 51,
+ INSTALLER_ERROR_FATAL_ERROR = 61,
+ INSTALLER_ERROR_OUT_OF_STORAGE = 62,
+ INSTALLER_ERROR_OUT_OF_MEMORY = 63,
+
+ INSTALLER_ERROR_USER_CANCEL = 141,
+ INSTALLER_ERROR_UNMOUNT_FAILED = 142,
+ INSTALLER_ERROR_INTERNAL_STATE = 143,
+ INSTALLER_ERROR_DATABASE = 144,
+ INSTALLER_ERROR_DRM = 145,
};
enum InstallerOperation
InstallationContext::Construct(void)
{
__pPackageInfoImpl = new (std::nothrow) _PackageInfoImpl();
- TryReturn(__pPackageInfoImpl, INSTALLER_ERROR_MEMORY, "[osp-installer] __pPackageInfoImpl is null.");
+ TryReturn(__pPackageInfoImpl, INSTALLER_ERROR_OUT_OF_MEMORY, "[osp-installer] __pPackageInfoImpl is null.");
__pAppDataList = new (std::nothrow) ArrayListT<AppData*>;
- TryReturn(__pAppDataList, INSTALLER_ERROR_MEMORY, "[osp-installer] __pAppDataList is null");
+ TryReturn(__pAppDataList, INSTALLER_ERROR_OUT_OF_MEMORY, "[osp-installer] __pAppDataList is null");
return INSTALLER_ERROR_NONE;
}
result r = E_SUCCESS;
__pContext = new InstallationContext();
- TryReturn(__pContext, INSTALLER_ERROR_MEMORY, "[osp-installer] __pContext is null.");
+ TryReturn(__pContext, INSTALLER_ERROR_OUT_OF_MEMORY, "[osp-installer] __pContext is null.");
error = __pContext->Construct();
TryReturn(error == INSTALLER_ERROR_NONE, INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] __pContext->Construct() failed.");
{
FileAttributes attr;
r = File::GetAttributes(path, attr);
- TryReturn(!IsFailed(r), INSTALLER_ERROR_INVALID_PACKAGE, "[osp-installer] File::GetAttributes() failed");
+ TryReturn(!IsFailed(r), INSTALLER_ERROR_PACKAGE_NOT_FOUND, "[osp-installer] File::GetAttributes() failed");
if (attr.IsDirectory())
{
if (error != INSTALLER_ERROR_NONE)
{
__pContext->SetError(error);
- fprintf(stderr, "Activate:: Error = [%d]\n", error);
Error();
return error;
}
InstallerUtil::Remove(DIR_OSP_APPLICATIONS_TEMP);
}
- if (errorType != INSTALLER_ERROR_NONE)
- {
- fprintf(stderr, " ErrorType [%d]\n", errorType);
- }
-
SetErrorType(errorType);
return errorType;
}
fprintf(stderr, "------------------------------------------\n");
AppLogTag(OSP_INSTALLER, "------------------------------------------");
- fprintf(stderr, " # directory = [%ls]\n", entryDir.GetPointer());
- AppLogTag(OSP_INSTALLER, " # directory = [%ls]", entryDir.GetPointer());
+ fprintf(stderr, " # Directory = [%ls]\n", entryDir.GetPointer());
+ AppLogTag(OSP_INSTALLER, " # Directory = [%ls]", entryDir.GetPointer());
errorType = Request(entryDir, INSTALLER_OPERATION_INSTALL, REQUESTER_TYPE_PRELOADED);
if (errorType == 0)
{
fprintf(stderr, "------------------------------------------\n");
AppLogTag(OSP_INSTALLER, "------------------------------------------");
- fprintf(stderr, " # directory = [%s]\n", buf);
- AppLogTag(OSP_INSTALLER, " # directory = [%s]", buf);
+ fprintf(stderr, " # Directory = [%s]\n", buf);
+ AppLogTag(OSP_INSTALLER, " # Directory = [%s]", buf);
errorType = Request(buf, INSTALLER_OPERATION_INSTALL, REQUESTER_TYPE_NORMAL, hybridService);
if (errorType != 0)
{
fprintf(stderr, "------------------------------------------\n");
AppLogTag(OSP_INSTALLER, "------------------------------------------");
- fprintf(stderr, " # directory = [%s]\n", buf);
- AppLogTag(OSP_INSTALLER, " # directory = [%s]", buf);
+ fprintf(stderr, " # Directory = [%s]\n", buf);
+ AppLogTag(OSP_INSTALLER, " # Directory = [%s]", buf);
errorType = Request(buf, INSTALLER_OPERATION_UNINSTALL, REQUESTER_TYPE_NORMAL, hybridService);
PrintResult();
char readBuf[512] = {0};
r = File::GetAttributes(L"/opt/apps/cmtamb4mtv/data/configuration", attr);
- TryCatch(!IsFailed(r), errorType = INSTALLER_ERROR_INVALID_PACKAGE, "[osp-installer] file not found");
+ TryCatch(!IsFailed(r), errorType = INSTALLER_ERROR_PACKAGE_NOT_FOUND, "[osp-installer] file not found");
r = file.Construct(L"/opt/apps/cmtamb4mtv/data/configuration", L"r");
- TryCatch(!IsFailed(r), errorType = INSTALLER_ERROR_INVALID_PACKAGE, "[osp-installer] file.Construct failed");
+ TryCatch(!IsFailed(r), errorType = INSTALLER_ERROR_PACKAGE_NOT_FOUND, "[osp-installer] file.Construct failed");
if (file.Read(readBuf, sizeof(readBuf)-1) > 1)
{
void
InstallerManager::PrintResult(void)
{
- String appId = GetId();
+ String packageId = GetId();
int errorType = GetErrorType();
InstallerOperation operation = GetInstallerOperation();
AppLogTag(OSP_INSTALLER, "==========================================");
AppLogTag(OSP_INSTALLER, "%s Result", (operation == INSTALLER_OPERATION_INSTALL)?"Installation":"Uninstallation");
AppLogTag(OSP_INSTALLER, " # %s", OSP_INSTALLER_VERSION);
- AppLogTag(OSP_INSTALLER, " # AppId = [%ls], errorType = [%d]", appId.GetPointer(), errorType);
- AppLogTag(OSP_INSTALLER, " # result = [%s]", (errorType == 0)?"Success":"Failure");
- AppLogTag(OSP_INSTALLER, " # operation time = [%d](start=%d, end=%d)", (int)(__endTick-__startTick), (int)__startTick, (int)__endTick);
+ AppLogTag(OSP_INSTALLER, " # PackageId = [%ls]", packageId.IsEmpty() ? L"Unknown" : packageId.GetPointer());
+ AppLogTag(OSP_INSTALLER, " # Result = [%s]", (errorType == 0)?"Success":"Failure");
+ AppLogTag(OSP_INSTALLER, " # Time = [%d]ms (start=%d, end=%d)", (int)(__endTick-__startTick), (int)__startTick, (int)__endTick);
AppLogTag(OSP_INSTALLER, "==========================================");
- fprintf(stderr, " # AppId = [%ls], errorType = [%d]\n", appId.GetPointer(), errorType);
- fprintf(stderr, " # operation = [%s]\n", (operation == INSTALLER_OPERATION_INSTALL)?"Installation":"Uninstallation");
- fprintf(stderr, " # result = [%s]\n", (errorType == 0)?"Success":"Failure");
- fprintf(stderr, " # operation time = [%d] ms(start=%d, end=%d)\n", (int)(__endTick-__startTick), (int)__startTick, (int)__endTick);
+ fprintf(stderr, " # PackageId = [%ls]\n", packageId.IsEmpty() ? L"Unknown" : packageId.GetPointer());
+ fprintf(stderr, " # Operation = [%s]\n", (operation == INSTALLER_OPERATION_INSTALL)?"Installation":"Uninstallation");
+ fprintf(stderr, " # Result = [%s]\n", (errorType == 0)?"Success":"Failure");
+ fprintf(stderr, " # Time = [%d]ms (start=%d, end=%d)\n", (int)(__endTick-__startTick), (int)__startTick, (int)__endTick);
+
+ PrintError(errorType);
+}
+
+void
+InstallerManager::PrintError(int errorType)
+{
+ const char* pError = null;
+
+ switch (errorType)
+ {
+ case INSTALLER_ERROR_NONE:
+ pError = "Success";
+ break;
+
+ case INSTALLER_ERROR_PACKAGE_NOT_FOUND:
+ pError = "[PACKAGE_NOT_FOUND] Thrown when package file is not found.";
+ break;
+
+ case INSTALLER_ERROR_PACKAGE_INVALID:
+ pError = "[PACKAGE_INVALID] Thrown when package file is not valid due to file operation or directory hierarchy.";
+ break;
+
+ case INSTALLER_ERROR_PACKAGE_LOWER_VERSION:
+ pError = "[PACKAGE_LOWER_VERSION] Thrown when the lower version package is tried to install.";
+ break;
+
+ case INSTALLER_ERROR_EXECUTABLE_NOT_FOUND:
+ pError = "[EXECUTABLE_NOT_FOUND] Thrown when executable file is not found in the package.";
+ break;
+
+ case INSTALLER_ERROR_MANIFEST_NOT_FOUND:
+ pError = "[MANIFEST_NOT_FOUND] Thrown when manifest.xml is not found in the package.";
+ break;
+
+ case INSTALLER_ERROR_MANIFEST_INVALID:
+ pError = "[MANIFEST_INVALID] Thrown when manifest.xml is not valid due to schema or parsing failure.";
+ break;
+
+ case INSTALLER_ERROR_SIGNATURE_NOT_FOUND:
+ pError = "[SIGNATURE_NOT_FOUND] Thrown when the signature files are not found in the package.";
+ break;
+
+ case INSTALLER_ERROR_SIGNATURE_INVALID:
+ pError = "[SIGNATURE_INVALID] Thrown when the signature files are not valid due to schema or parsing failure.";
+ break;
+
+ case INSTALLER_ERROR_SIGNATURE_VERIFICATION_FAILED:
+ pError = "[SIGNATURE_VERIFICATION_FAILED] Thrown when the signature verification has failed due to be modified illegally.";
+ break;
+
+ case INSTALLER_ERROR_ROOT_CERTIFICATE_NOT_FOUND:
+ pError = "[ROOT_CERTIFICATE_NOT_FOUND] Thrown when the root certificate is not found.";
+ break;
+
+ case INSTALLER_ERROR_CERTIFICATE_INVALID:
+ pError = "[CERTIFICATE_INVALID] Thrown when the certificate verification has failed.";
+ break;
+
+ case INSTALLER_ERROR_CERTIFICATE_CHAIN_VERIFICATION_FAILED:
+ pError = "[CERTIFICATE_CHAIN_VERIFICATION_FAILED] Thrown when the certificate chain verification has failed.";
+ break;
+
+ case INSTALLER_ERROR_CERTIFICATE_EXPIRED:
+ pError = "[CERTIFICATE_EXPIRED] Thrown when the used certificates have expired.";
+ break;
+
+ case INSTALLER_ERROR_PRIVILEGE_INVALID:
+ pError = "[PRIVILEGE_INVALID] Thrown when unsupported privilege strings are detected.";
+ break;
+
+ case INSTALLER_ERROR_MENU_ICON_NOT_FOUND:
+ pError = "[MENU_ICON_NOT_FOUND] Thrown when an icon for menu is not found. This icon is mandatory.";
+ break;
+
+ case INSTALLER_ERROR_FATAL_ERROR:
+ pError = "[FATAL_ERROR] Thrown when an icon for menu is not found. This icon is mandatory.";
+ break;
+
+ case INSTALLER_ERROR_OUT_OF_STORAGE:
+ pError = "[OUT_OF_STORAGE] Thrown when the storage is full.";
+ break;
+
+ case INSTALLER_ERROR_OUT_OF_MEMORY:
+ pError = "[OUT_OF_MEMORY] Thrown when the memory is not sufficient to perform the requested installation or uninstallation.";
+ break;
+
+ default:
+ pError = "fatal error";
+ break;
+ }
+
+ AppLogTag(OSP_INSTALLER, " # Error = %s(%d)", pError, errorType);
+ fprintf(stderr, " # Error = %s(%d)\n", pError, errorType);
}
const PackageId&
void PrintPackageInfo(const char* appId);
void PrintResult(void);
+ void PrintError(int errorType);
const Tizen::App::PackageId& GetId(void) const;
void SetId(const Tizen::App::PackageId& appId);
if (error != INSTALLER_ERROR_NONE)
{
- fprintf(stderr, "DrmStep::Run - ErrorType [%d]\n", error);
break;
}
if (error != INSTALLER_ERROR_NONE)
{
- fprintf(stderr, "LicenseStep::Run - ErrorType [%d]\n", error);
break;
}
if (error != INSTALLER_ERROR_NONE)
{
- fprintf(stderr, "ManifestXmlStep::Run - ErrorType [%d]\n", error);
break;
}
fprintf(stderr, "OnStateManifestXml - File::GetAttributes is failed. [%ls]\n", __pContext->GetManifestXmlPath().GetPointer());
AppLogTag(OSP_INSTALLER, "OnStateManifestXml - File::GetAttributes is failed. [%ls]\n", __pContext->GetManifestXmlPath().GetPointer());
}
- TryReturn(!IsFailed(r), INSTALLER_ERROR_INVALID_PACKAGE, "[osp-installer] File::GetAttributes() failed");
+ TryReturn(!IsFailed(r), INSTALLER_ERROR_MANIFEST_NOT_FOUND, "[osp-installer] File::GetAttributes() failed");
std::unique_ptr<char[]> pFilepath(_StringConverter::CopyToCharArrayN(manifestXmlPath));
- TryReturn(pFilepath, INSTALLER_ERROR_INVALID_PACKAGE, "[osp-installer] pFilepath is null");
+ TryReturn(pFilepath, INSTALLER_ERROR_OUT_OF_MEMORY, "[osp-installer] pFilepath is null");
AppLogTag(OSP_INSTALLER, "manifest file=[%ls]", manifestXmlPath.GetPointer());
{
fprintf(stderr, "OnStateManifestXml - manifestHandler.Parse is failed. [%s]\n", pFilepath.get());
}
- TryReturn(ret == true, INSTALLER_ERROR_INVALID_MANIFEST, "[osp-installer] manifestHandler.Parse() failed");
+ TryReturn(ret == true, INSTALLER_ERROR_MANIFEST_INVALID, "[osp-installer] manifestHandler.Parse() failed");
pPackageInfoImpl = __pContext->GetPackageInfoImpl();
- TryReturn(pPackageInfoImpl, error = INSTALLER_ERROR_INVALID_MANIFEST, "[osp-installer] pPackageInfoImpl is null");
+ TryReturn(pPackageInfoImpl, error = INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] pPackageInfoImpl is null");
__pContext->SetId(pPackageInfoImpl->GetId());
GoNextState();
if (error != INSTALLER_ERROR_NONE)
{
- fprintf(stderr, "PackageCheckStep::Run - ErrorType [%d]\n", error);
break;
}
if (error != INSTALLER_ERROR_NONE)
{
- AppLogTag(OSP_INSTALLER, "SignatureStep::Run - ErrorType [%d]\n", error);
- //fprintf(stderr, "SignatureStep::Run - ErrorType [%d]\n", error);
break;
}
bool ret = true;
__pSignatureManager = new (std::nothrow) SignatureManager();
- TryCatch(__pSignatureManager, error = INSTALLER_ERROR_MEMORY, "[osp-installer] __pSignatureManager is null.");
+ TryCatch(__pSignatureManager, error = INSTALLER_ERROR_OUT_OF_MEMORY, "[osp-installer] __pSignatureManager is null.");
ret = __pSignatureManager->Construct(__pContext);
TryCatch(ret == true, error = INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] Construct() failed");
ret = __pSignatureManager->SetSignature();
- TryCatch(ret == true, error = INSTALLER_ERROR_INVALID_SIGNATURE, "[osp-installer] SetSignature() failed");
+ TryCatch(ret == true, error = INSTALLER_ERROR_SIGNATURE_INVALID, "[osp-installer] SetSignature() failed");
CATCH:
GoNextState();
bool ret = true;
ret = __pSignatureManager->AddCert();
- TryCatch(ret == true, error = INSTALLER_ERROR_INVALID_SIGNATURE, "[osp-installer] AddCert(DEVELOPER_ROOT_CERTIFICATE) failed");
+ TryCatch(ret == true, error = INSTALLER_ERROR_CERTIFICATE_CHAIN_VERIFICATION_FAILED, "[osp-installer] AddCert(DEVELOPER_ROOT_CERTIFICATE) failed");
ret = __pSignatureManager->VerifyChain();
- TryCatch(ret == true, error = INSTALLER_ERROR_INVALID_SIGNATURE, "[osp-installer] VerifyChain() failed");
+ TryCatch(ret == true, error = INSTALLER_ERROR_CERTIFICATE_CHAIN_VERIFICATION_FAILED, "[osp-installer] VerifyChain() failed");
CATCH:
GoNextState();
{
fprintf(stderr, "PrivilegeHandler::GenerateCipherPrivilege is failded. [%ls][%ls][%ls]\n", appId.GetPointer(), privileges.GetPointer(), hmacPrivileges.GetPointer());
}
- TryCatch(!IsFailed(r), error = INSTALLER_ERROR_PRIVILEGE, "[osp-installer] privMgr.GeneratePrivilegeString() failed");
+ TryCatch(!IsFailed(r), error = INSTALLER_ERROR_PRIVILEGE_INVALID, "[osp-installer] privMgr.GeneratePrivilegeString() failed");
pPackageInfoImpl->SetPrivilegesValue(privileges, hmacPrivileges);
pPackageInfoImpl->SetCertType(apiVisibility);
if (error != INSTALLER_ERROR_NONE)
{
- fprintf(stderr, "SystemCheckStep::Run - ErrorType [%d]\n", error);
break;
}
if (error != INSTALLER_ERROR_NONE)
{
- fprintf(stderr, "UninstallStep::Run - ErrorType [%d]\n", error);
break;
}
if (error != INSTALLER_ERROR_NONE)
{
- fprintf(stderr, "UnpackStep::Run - ErrorType [%d]\n", error);
break;
}
}
bool
+__osp_installer_send_error(int errorType)
+{
+ char errorMsg[11] = {0};
+ int error = 0;
+
+ if (errorType >= INSTALLER_ERROR_USER_CANCEL)
+ {
+ error = INSTALLER_ERROR_FATAL_ERROR;
+ }
+
+ snprintf(errorMsg, sizeof(errorMsg) - 1, "%d", error);
+ pkgmgr_installer_send_signal(_pi, "tpk", "", "error", errorMsg);
+
+ return true;
+}
+
+bool
__osp_installer_report_result(const String& appId, int errorType)
{
int ret = 0;
{
snprintf(resultBuf, sizeof(resultBuf), "0000000000");
pValue = "fail";
+ __osp_installer_send_error(errorType);
}
ret = pkgmgr_installer_send_signal(_pi, pPkgType, resultBuf, pKey, pValue);