#define DIR_MEMORYCARD_OSP_APPLICATIONS_TEMP L"/opt/storage/sdcard/apps/__@@osp_tmp@@__"
#define OSP_INSTALLER "osp-installer"
-#define OSP_INSTALLER_VERSION "osp-installer version = 2012/09/24"
+#define OSP_INSTALLER_VERSION "osp-installer version = 2012/10/09"
enum InstallationSetStep
{
,__stepChanged(true)
,__continue(true)
,__preloaded(false)
-,__webService(false)
+,__hybridService(false)
,__operation(INSTALLER_OPERATION_INSTALL)
,__storage(INSTALLATION_STORAGE_INTERNAL)
,__pPrivilegeList(null)
__preloaded = preloaded;
}
+bool
+InstallationContext::IsHybridService(void)
+{
+ return __hybridService;
+}
+
+void
+InstallationContext::SetHybridService(bool hybridService)
+{
+ __hybridService = hybridService;
+}
+
const String&
InstallationContext::GetPackagePath(void) const
{
bool IsPreloaded(void);
void SetPreloaded(bool preloaded);
+ bool IsHybridService(void);
+ void SetHybridService(bool hybridService);
+
const Osp::Base::String& GetPackagePath(void) const;
void SetPackagePath(const Osp::Base::String& packagePath);
bool __stepChanged;
bool __continue;
bool __preloaded;
- bool __webService;
+ bool __hybridService;
Osp::Base::String __inputPath;
InstallerOperation __operation;
String xmlPath;
char* pXmlPath = null;
int err = 0;
+ bool hybridService = pContext->IsHybridService();
_PackageInfoImpl *pPackageInfoImpl = null;
pPackageInfoImpl = pContext->GetPackageInfoImpl();
pXmlPath = _StringConverter::CopyToCharArrayN(xmlPath);
TryCatch(pXmlPath != null, res = false, "[osp-installer] pXmlPath is null");
- pkgmgr_parser_parse_manifest_for_uninstallation(pXmlPath, null);
-
- CreateSystemXmlFile(pContext);
+ if (hybridService == true)
+ {
+ CreateHybridServiceDesktopFile(pContext);
+ }
+ else
+ {
+ pkgmgr_parser_parse_manifest_for_uninstallation(pXmlPath, null);
+ CreateSystemXmlFile(pContext);
+ }
AppLogTag(OSP_INSTALLER, "START(sync)");
sync();
AppLogTag(OSP_INSTALLER, "END(sync)");
- AppLogTag(OSP_INSTALLER, "pkgmgr_parser_parse_manifest_for_installation() START");
- if (pkgmgr_parser_parse_manifest_for_installation(pXmlPath, null) != 0)
+ if (hybridService == false)
{
- AppLogTag(OSP_INSTALLER, "pkgmgr_parser_parse_manifest_for_installation() is failed.[%s]", pXmlPath);
+ AppLogTag(OSP_INSTALLER, "pkgmgr_parser_parse_manifest_for_installation() START");
+ if (pkgmgr_parser_parse_manifest_for_installation(pXmlPath, null) != 0)
+ {
+ AppLogTag(OSP_INSTALLER, "pkgmgr_parser_parse_manifest_for_installation() is failed.[%s]", pXmlPath);
+ }
+ AppLogTag(OSP_INSTALLER, "pkgmgr_parser_parse_manifest_for_installation() END");
}
- AppLogTag(OSP_INSTALLER, "pkgmgr_parser_parse_manifest_for_installation() END");
res = true;
pXmlPath = _StringConverter::CopyToCharArrayN(xmlPath);
TryCatch(pXmlPath != null, , "[osp-installer] pXmlPath is null");
- AppLogTag(OSP_INSTALLER, "pkgmgr_parser_parse_manifest_for_uninstallation() START");
- if (pkgmgr_parser_parse_manifest_for_uninstallation(pXmlPath, null) != 0)
+ if (pContext->IsHybridService() == true)
{
- AppLogTag(OSP_INSTALLER, "pkgmgr_parser_parse_manifest_for_uninstallation() is failed.[%s]", pXmlPath);
- }
- AppLogTag(OSP_INSTALLER, "pkgmgr_parser_parse_manifest_for_uninstallation() END");
+ AppLogTag(OSP_INSTALLER, "Uninstallation for HybridService - skip");
- if (File::IsFileExist(xmlPath) == true)
+ }
+ else
{
- AppLogTag(OSP_INSTALLER, "removing xml filePath=[%ls]", xmlPath.GetPointer());
+ AppLogTag(OSP_INSTALLER, "pkgmgr_parser_parse_manifest_for_uninstallation() START");
+ if (pkgmgr_parser_parse_manifest_for_uninstallation(pXmlPath, null) != 0)
+ {
+ AppLogTag(OSP_INSTALLER, "pkgmgr_parser_parse_manifest_for_uninstallation() is failed.[%s]", pXmlPath);
+ }
+ AppLogTag(OSP_INSTALLER, "pkgmgr_parser_parse_manifest_for_uninstallation() END");
+
+ if (File::IsFileExist(xmlPath) == true)
+ {
+ AppLogTag(OSP_INSTALLER, "removing xml filePath=[%ls]", xmlPath.GetPointer());
- InstallerUtil::Remove(xmlPath);
+ InstallerUtil::Remove(xmlPath);
+ }
}
pPackageInfoImpl = pContext->GetPackageInfoImpl();
}
bool
+ConfigurationManager::CreateHybridServiceDesktopFile(InstallationContext* pContext)
+{
+ AppLogTag(OSP_INSTALLER, "HybridServiceDesktopFile - START");
+
+ bool ret = true;
+ _PackageInfoImpl *pPackageInfoImpl = pContext->GetPackageInfoImpl();
+ _PackageAppInfoImpl* pAppInfoImpl = null;
+ ArrayList* pAppList = null;
+ pAppList = pPackageInfoImpl->GetAppInfoList();
+
+ for (int i = 0 ; i < pAppList->GetCount(); i++)
+ {
+ pAppInfoImpl = dynamic_cast<_PackageAppInfoImpl*>(pAppList->GetAt(i));
+
+ if (pAppInfoImpl)
+ {
+ String name;
+ name.Format(1024, L"%ls", pPackageInfoImpl->GetAppName().GetPointer());
+
+ String binaryPath;
+ binaryPath.Format(1024, L"%ls%ls/%ls", pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_BIN, pAppInfoImpl->GetName().GetPointer());
+
+ String iconPath;
+ iconPath.Format(1024, L"%ls%ls/%ls", pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_ICONS, pAppInfoImpl->GetMainmenuIcon().GetPointer());
+
+ String version;
+ version.Format(1024, L"%ls", pPackageInfoImpl->GetAppVersion().GetPointer());
+
+ String desktop;
+ desktop.Format(1024, L"[Desktop Entry]\n"
+ "Name=%ls\n"
+ "Name[en_GB]=%ls\n"
+ "Type=Application\n"
+ "Exec=%ls\n"
+ "Icon=%ls\n"
+ "Version=%ls\n"
+ "NoDisplay=true\n"
+ "X-TIZEN-TaskManage=False\n"
+ "X-TIZEN-PackageType=tpk\n",
+ name.GetPointer(), name.GetPointer(), binaryPath.GetPointer(), iconPath.GetPointer(), version.GetPointer());
+
+ String desktopPath;
+ desktopPath.Format(1024, L"/opt/share/applications/%ls.desktop", pAppInfoImpl->GetPackageName().GetPointer());
+
+ if (File::IsFileExist(desktopPath) == true)
+ {
+ AppLogTag(OSP_INSTALLER, "removing desktop filePath=[%ls]", desktopPath.GetPointer());
+ InstallerUtil::Remove(desktopPath);
+ }
+
+ CreateInfoFile(desktopPath, &desktop);
+ }
+ }
+
+ AppLogTag(OSP_INSTALLER, "HybridServiceDesktopFile - END");
+
+ return ret;
+}
+
+bool
ConfigurationManager::CreateInfoFile(const String& filePath, const String* pContext)
{
result r = E_SUCCESS;
private:
bool CreateSystemXmlFile(InstallationContext* pContext);
+ bool CreateHybridServiceDesktopFile(InstallationContext* pContext);
bool CreateInfoFile(const Osp::Base::String& filePath, const Osp::Base::String* pContext);
bool FindPrivilege(InstallationContext* pContext, const Osp::Base::String& privilege) const;
}
InstallerError
-InstallerManager::Construct(const String& path, InstallerType installerType, InstallerOperation operation, RequesterType requesterType)
+InstallerManager::Construct(const String& path, InstallerType installerType, InstallerOperation operation, RequesterType requesterType, bool hybridService)
{
InstallerError error = INSTALLER_ERROR_NONE;
__pContext->SetPreloaded(true);
}
+ if (hybridService == true)
+ {
+ AppLogTag(OSP_INSTALLER, "Request to install HybridService app!");
+ __pContext->SetHybridService(true);
+ }
+
__pInstaller = CreateInstaller(installerType);
TryReturn(__pInstaller, INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] __pInstaller is null.");
}
int
-InstallerManager::Request(const String& path, InstallerOperation operation, RequesterType requesterType, String& appid, int& errorType)
+InstallerManager::Request(const String& path, InstallerOperation operation, RequesterType requesterType, String& appid, int& errorType, bool hybridService)
{
InstallerType type = INSTALLER_TYPE_INSTALLER;
InstallationContext* pContext = null;
InstallerError error = INSTALLER_ERROR_NONE;
InstallerManager* pInstallManager = null;
- //bool isRunning = false;
AppLogTag(OSP_INSTALLER, "------------------------------------------");
AppLogTag(OSP_INSTALLER, "InstallerManager::Request");
pInstallManager = InstallerManager::GetInstance();
TryCatch(pInstallManager, error = INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] pInstallManager is null.");
- error = pInstallManager->Construct(path, type, operation, requesterType);
+ error = pInstallManager->Construct(path, type, operation, requesterType, hybridService);
TryCatch(error == INSTALLER_ERROR_NONE, , "[osp-installer] pInstallManager->Construct() failed.");
error = pInstallManager->Activate();
int errorType = -1;
int result = 0;
bool output = false;
+ bool hybridService = false;
fprintf(stderr, "%s\n", OSP_INSTALLER_VERSION);
AppLogTag(OSP_INSTALLER, "%s", OSP_INSTALLER_VERSION);
ParseCommandArg(argc, argv, &mode, buf, &output);
+ if (output == true)
+ {
+ AppLogTag(OSP_INSTALLER, "HybridService is detected in ParseCommandArg()");
+ hybridService = true;
+ }
+
switch (mode)
{
case INSTALLER_MODE_INSTALL:
fprintf(stderr, " # directory = [%s]\n", buf);
AppLogTag(OSP_INSTALLER, " # directory = [%s]", buf);
- result = InstallerManager::Request(buf, INSTALLER_OPERATION_INSTALL, REQUESTER_TYPE_NORMAL, appId, errorType);
+ result = InstallerManager::Request(buf, INSTALLER_OPERATION_INSTALL, REQUESTER_TYPE_NORMAL, appId, errorType, hybridService);
fprintf(stderr, " # appId = [%ls], error = [%d]\n", appId.GetPointer(), errorType);
AppLogTag(OSP_INSTALLER, " # appId = [%ls], error = [%d]", appId.GetPointer(), errorType);
fprintf(stderr, " # directory = [%s]\n", buf);
AppLogTag(OSP_INSTALLER, " # directory = [%s]", buf);
- result = Request(buf, INSTALLER_OPERATION_UNINSTALL, REQUESTER_TYPE_NORMAL, appId, errorType);
+ result = Request(buf, INSTALLER_OPERATION_UNINSTALL, REQUESTER_TYPE_NORMAL, appId, errorType, hybridService);
fprintf(stderr, " # appId = [%ls], error = [%d]\n", appId.GetPointer(), errorType);
AppLogTag(OSP_INSTALLER, " # appId = [%ls], error = [%d]", appId.GetPointer(), errorType);
{
public:
InstallerManager(void);
- InstallerError Construct(const Osp::Base::String& path, InstallerType installerType, InstallerOperation op, RequesterType requesterType);
+ InstallerError Construct(const Osp::Base::String& path, InstallerType installerType, InstallerOperation op, RequesterType requesterType, bool hybridService = false);
virtual ~InstallerManager(void);
static InstallerManager* GetInstance(void);
void Release(void);
- int Request(const Osp::Base::String& path, InstallerOperation op, RequesterType requesterType, Osp::Base::String& appid, int& errorType);
+ int Request(const Osp::Base::String& path, InstallerOperation op, RequesterType requesterType, Osp::Base::String& appid, int& errorType, bool hybridService = false);
int RequestRecursiveDirectory(const Osp::Base::String& path, int& errorType);
bool RemoveGarbage(const char* pDirectory);
TryReturn(pPackageInfoImpl, false, "[osp-installer] pPackageInfoImpl is null.");
pAppList = pPackageInfoImpl->GetAppInfoList();
+ TryReturn(pAppList, false, "[osp-installer] pAppList is null.");
for (int i = 0 ; i < pAppList->GetCount(); i++)
{
STATE_DONE
};
+ SignatureStep(const SignatureStep& value);
+ SignatureStep& operator =(const SignatureStep& source);
+
void GoNextState(void);
InstallerError OnStateSignerCert(void);
InstallerError OnStateCertChain(void);
InstallerError error = INSTALLER_ERROR_NONE;
AppLogTag(OSP_INSTALLER, "UninstallStep::OnStateCheckAppRunning()");
+ if (__pContext->IsHybridService() == true)
+ {
+ AppLogTag(OSP_INSTALLER, "Uninstallation for HybridService");
+ __state = STATE_DELETE_DIR;
+ return error;
+ }
+
String appId;
appId = __pContext->GetAppId();
AppLogTag(OSP_INSTALLER, "rootPath[%ls]", rootPath.GetPointer());
AppLogTag(OSP_INSTALLER, "Directory::Remove - START");
- InstallerUtil::Remove(rootPath);
+
+ if (__pContext->IsHybridService() == true)
+ {
+ AppLogTag(OSP_INSTALLER, "Uninstallation for HybridService - skip Remove");
+
+ }
+ else
+ {
+ InstallerUtil::Remove(rootPath);
+ }
_PackageAppInfoImpl* pAppInfoImpl = null;
ArrayList* pAppList = null;
pPackageInfoImpl = __pContext->GetPackageInfoImpl();
TryReturn(pPackageInfoImpl, false, "[osp-installer] pPackageInfoImpl is null.");
- if (preload == true)
- {
- xmlPath.Format(1024, DIR_RO_PACKAGE_SYSTEM_MANIFEST, __pContext->GetAppId().GetPointer());
- location = L"internal-only";
- }
- else
- {
+ //if (preload == true)
+ //{
+ // xmlPath.Format(1024, DIR_RO_PACKAGE_SYSTEM_MANIFEST, __pContext->GetAppId().GetPointer());
+ // location = L"internal-only";
+ //}
+ //else
+ //{
xmlPath.Format(1024, DIR_RW_PACKAGE_SYSTEM_MANIFEST, __pContext->GetAppId().GetPointer());
location = L"auto";
- }
+ //}
package = __pContext->GetAppId();