From d88350a62d7c69a9b473247d257c747de320686d Mon Sep 17 00:00:00 2001 From: Duyoung Jang Date: Thu, 28 Mar 2013 15:33:55 +0900 Subject: [PATCH] Change smack script Change-Id: Ic1a381ad503f50119e6a657c1199ca6786860a2f Signed-off-by: Duyoung Jang --- inc/InstallerDefs.h | 2 +- src/Manager/ConfigurationManager.cpp | 35 ++++++----------------------------- src/Manager/ConfigurationManager.h | 1 - src/Manager/SmackManager.cpp | 25 ++++++++----------------- src/Util/InstallerUtil.cpp | 23 +++++++++++++++++++++++ src/Util/InstallerUtil.h | 1 + 6 files changed, 39 insertions(+), 48 deletions(-) diff --git a/inc/InstallerDefs.h b/inc/InstallerDefs.h index 428c35f..f87b48e 100755 --- a/inc/InstallerDefs.h +++ b/inc/InstallerDefs.h @@ -23,7 +23,7 @@ #include "InstallerUtil.h" -#define OSP_INSTALLER_VERSION "version=[20130328.1]" +#define OSP_INSTALLER_VERSION "version=[20130328.2]" #define DIR_BIN L"/bin" #define DIR_INFO L"/info" diff --git a/src/Manager/ConfigurationManager.cpp b/src/Manager/ConfigurationManager.cpp index 8dbee89..415e900 100755 --- a/src/Manager/ConfigurationManager.cpp +++ b/src/Manager/ConfigurationManager.cpp @@ -67,7 +67,7 @@ ConfigurationManager::CreateFile(InstallationContext* pContext) apiVersion = pContext->__apiVersion; String versionInfoFile; versionInfoFile.Format(1024, L"%ls%ls", rootPath.GetPointer(), VERSION_INFO_FILE); - CreateInfoFile(versionInfoFile, &apiVersion); + InstallerUtil::CreateInfoFile(versionInfoFile, &apiVersion); if (pContext->__isOspCompat == true) { @@ -75,7 +75,7 @@ ConfigurationManager::CreateFile(InstallationContext* pContext) String compatInfoFile; compatInfoFile.Format(1024, L"%ls%ls", rootPath.GetPointer(), COMPAT_INFO_FILE); - CreateInfoFile(compatInfoFile, null); + InstallerUtil::CreateInfoFile(compatInfoFile, null); } String webServicePrivilege(TIZEN_PRIVILEGE_WEB_SERVICE); @@ -85,7 +85,7 @@ ConfigurationManager::CreateFile(InstallationContext* pContext) String webServiceInfoFile; webServiceInfoFile.Format(1024, L"%ls%ls", rootPath.GetPointer(), WEBSERVICE_INFO_FILE); - CreateInfoFile(webServiceInfoFile, null); + InstallerUtil::CreateInfoFile(webServiceInfoFile, null); } IListT* pAppDataList = pContext->__pAppDataList; @@ -156,7 +156,7 @@ ConfigurationManager::CreateFile(InstallationContext* pContext) String uiScalabilityInfoFile; uiScalabilityInfoFile.Format(1024, L"%ls%ls", rootPath.GetPointer(), UISCALABILITY_INFO_FILE); - CreateInfoFile(uiScalabilityInfoFile, &uiScalability); + InstallerUtil::CreateInfoFile(uiScalabilityInfoFile, &uiScalability); int categoryType = pAppData->__feature; if (categoryType != CATEGORY_TYPE_NONE) @@ -177,7 +177,7 @@ ConfigurationManager::CreateFile(InstallationContext* pContext) String typeInfoFile; typeInfoFile.Format(1024, L"%ls%ls", rootPath.GetPointer(), TYPE_INFO_FILE); - CreateInfoFile(typeInfoFile, &typeInfo); + InstallerUtil::CreateInfoFile(typeInfoFile, &typeInfo); } } else if (appType == L"ServiceApp") @@ -620,7 +620,7 @@ ConfigurationManager::CreateCoreXmlFile(InstallationContext* pContext) // InstallerUtil::Remove(desktopPath); // } // -// CreateInfoFile(desktopPath, &desktop); +// InstallerUtil::CreateInfoFile(desktopPath, &desktop); // } // } // @@ -699,29 +699,6 @@ ConfigurationManager::MergeToSystemXmlFile(const String& systemXmlPath, const St } bool -ConfigurationManager::CreateInfoFile(const String& filePath, const String* pContext) -{ - result r = E_SUCCESS; - File file; - - r = file.Construct(filePath, "w"); - TryReturn(!IsFailed(r), false, "file.Construct() failed, filePath=[%ls]", filePath.GetPointer()); - - AppLog("------------------------------------------"); - AppLog("CreateInfoFile(), filePath = [%ls]", filePath.GetPointer()); - - if (pContext) - { - r = file.Write(*pContext); - TryReturn(!IsFailed(r), false, "file.Write() failed, filePath=[%ls]", filePath.GetPointer()); - AppLog("string = [%ls]", pContext->GetPointer()); - } - AppLog("------------------------------------------"); - - return true; -} - -bool ConfigurationManager::CreateImeSymlink(const String& binaryPath, const String& appId) { bool res = true; diff --git a/src/Manager/ConfigurationManager.h b/src/Manager/ConfigurationManager.h index a36379b..c56950b 100755 --- a/src/Manager/ConfigurationManager.h +++ b/src/Manager/ConfigurationManager.h @@ -53,7 +53,6 @@ private: // bool CreateHybridServiceDesktopFile(InstallationContext* pContext); bool MergeToSystemXmlFile(const Tizen::Base::String& systemXmlPath, const Tizen::Base::String& webXmlPath,const Tizen::Base::String& serviceXmlPath); - bool CreateInfoFile(const Tizen::Base::String& filePath, const Tizen::Base::String* pContext); bool CreateImeSymlink(const Tizen::Base::String& binaryPath, const Tizen::Base::String& packageName); bool FindPrivilege(InstallationContext* pContext, const Tizen::Base::String& privilege) const; bool SetCertHashValue(void* pHandle, Tizen::Security::Cert::X509CertificatePath* pCertPath, int certType) const; diff --git a/src/Manager/SmackManager.cpp b/src/Manager/SmackManager.cpp index 6af4e36..c90739c 100755 --- a/src/Manager/SmackManager.cpp +++ b/src/Manager/SmackManager.cpp @@ -191,18 +191,10 @@ SmackManager::AddPermissions(const PackageId& packageId) TryReturn(__pContext, false, "__pContext is null"); int res = 0; - String script("/usr/bin/smackload-app.sh"); - bool exist = File::IsFileExist(script); - - script.Append(L" "); - script.Append(packageId); std::unique_ptr pPackageId(_StringConverter::CopyToCharArrayN(packageId)); TryReturn(pPackageId, false, "pPackageId is null."); - std::unique_ptr pScript(_StringConverter::CopyToCharArrayN(script)); - TryReturn(pScript, false, "pScript is null."); - int count = __pContext->__pPrivilegeList->GetCount(); const char** pList = new (std::nothrow) const char*[count+1]; @@ -224,15 +216,14 @@ SmackManager::AddPermissions(const PackageId& packageId) res = AddPermissions(pPackageId.get(), pList); - if (exist == true) - { - res = system(pScript.get()); - AppLog("[smack] system(%s), result = [%d]", pScript.get(), res); - } - else - { - AppLog("[%ls] not found", script.GetPointer()); - } + String smackFile(L"/etc/smack/accesses2.d/"); + smackFile.Append(packageId); + smackFile.Append(L"-temp.rule"); + + String smackContext(packageId); + smackContext.Append(L" all.rule include"); + + InstallerUtil::CreateInfoFile(smackFile, &smackContext); for (int i = 0; pList[i] != null; i++) { diff --git a/src/Util/InstallerUtil.cpp b/src/Util/InstallerUtil.cpp index 378c3a0..6ee1f6e 100755 --- a/src/Util/InstallerUtil.cpp +++ b/src/Util/InstallerUtil.cpp @@ -437,6 +437,29 @@ InstallerUtil::CreateSymlinkForAppDirectory(const String& inPath, String& outPat } bool +InstallerUtil::CreateInfoFile(const String& filePath, const String* pContext) +{ + result r = E_SUCCESS; + File file; + + r = file.Construct(filePath, "w"); + TryReturn(!IsFailed(r), false, "file.Construct() failed, filePath=[%ls]", filePath.GetPointer()); + + AppLog("------------------------------------------"); + AppLog("CreateInfoFile(), filePath = [%ls]", filePath.GetPointer()); + + if (pContext) + { + r = file.Write(*pContext); + TryReturn(!IsFailed(r), false, "file.Write() failed, filePath=[%ls]", filePath.GetPointer()); + AppLog("string = [%ls]", pContext->GetPointer()); + } + AppLog("------------------------------------------"); + + return true; +} + +bool InstallerUtil::DumpLog(const char* pBuf) { char temp[4096] = {0}; diff --git a/src/Util/InstallerUtil.h b/src/Util/InstallerUtil.h index a5521a0..f03034a 100755 --- a/src/Util/InstallerUtil.h +++ b/src/Util/InstallerUtil.h @@ -60,6 +60,7 @@ public: static int GetCategoryType(char* pCategory); static bool CreateSymlinkForAppDirectory(const Tizen::Base::String& inPath, Tizen::Base::String& outPath); + static bool CreateInfoFile(const Tizen::Base::String& filePath, const Tizen::Base::String* pContext); static bool DumpLog(const char* pBuf); static bool DumpLogData(char *pData, int dataLen); -- 2.7.4