Change smack script
authorDuyoung Jang <duyoung.jang@samsung.com>
Thu, 28 Mar 2013 06:33:55 +0000 (15:33 +0900)
committerDuyoung Jang <duyoung.jang@samsung.com>
Thu, 28 Mar 2013 06:36:13 +0000 (15:36 +0900)
Change-Id: Ic1a381ad503f50119e6a657c1199ca6786860a2f
Signed-off-by: Duyoung Jang <duyoung.jang@samsung.com>
inc/InstallerDefs.h
src/Manager/ConfigurationManager.cpp
src/Manager/ConfigurationManager.h
src/Manager/SmackManager.cpp
src/Util/InstallerUtil.cpp
src/Util/InstallerUtil.h

index 428c35f..f87b48e 100755 (executable)
@@ -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"
index 8dbee89..415e900 100755 (executable)
@@ -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<AppData*>* 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;
index a36379b..c56950b 100755 (executable)
@@ -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;
index 6af4e36..c90739c 100755 (executable)
@@ -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<char[]> pPackageId(_StringConverter::CopyToCharArrayN(packageId));
        TryReturn(pPackageId, false, "pPackageId is null.");
 
-       std::unique_ptr<char[]> 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++)
        {
index 378c3a0..6ee1f6e 100755 (executable)
@@ -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};
index a5521a0..f03034a 100755 (executable)
@@ -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);