diff options
-rwxr-xr-x | inc/InstallerDefs.h | 2 | ||||
-rwxr-xr-x | src/Manager/CompatibilityManager.cpp | 6 | ||||
-rwxr-xr-x | src/Manager/SmackManager.cpp | 32 | ||||
-rwxr-xr-x | src/Manager/SmackManager.h | 1 | ||||
-rwxr-xr-x | src/Util/InstallerUtil.cpp | 12 | ||||
-rwxr-xr-x | src/Util/InstallerUtil.h | 2 |
6 files changed, 45 insertions, 10 deletions
diff --git a/inc/InstallerDefs.h b/inc/InstallerDefs.h index 769cab1..cdf00e0 100755 --- a/inc/InstallerDefs.h +++ b/inc/InstallerDefs.h @@ -23,7 +23,7 @@ #include "InstallerUtil.h" -#define OSP_INSTALLER_VERSION "version=[20130625.1]" +#define OSP_INSTALLER_VERSION "version=[20130628.1]" #define DIR_BIN L"/bin" #define DIR_INFO L"/info" diff --git a/src/Manager/CompatibilityManager.cpp b/src/Manager/CompatibilityManager.cpp index e695c27..cbb28b0 100755 --- a/src/Manager/CompatibilityManager.cpp +++ b/src/Manager/CompatibilityManager.cpp @@ -255,8 +255,8 @@ CompatibilityManager::LinkOspSharePath(const String& rootPath, const PackageId& unlink(ospSharePkgIdPath); unlink(ospShare2PkgIdPath); - InstallerUtil::CreateSymlink(ospAppSharePath, ospSharePkgIdPath); - InstallerUtil::CreateSymlink(ospAppShare2Path, ospShare2PkgIdPath); + InstallerUtil::CreateSymlink(ospAppSharePath, ospSharePkgIdPath, false); + InstallerUtil::CreateSymlink(ospAppShare2Path, ospShare2PkgIdPath, false); return true; } @@ -550,7 +550,7 @@ CompatibilityManager::CreateSymbolicLink(void) for (unsigned int i = 0; i < sizeof(linkDirList) / sizeof(struct _LinkDir); ++i) { - InstallerUtil::CreateSymlink(linkDirList[i].srcPath, linkDirList[i].destPath); + InstallerUtil::CreateSymlink(linkDirList[i].srcPath, linkDirList[i].destPath, false); } AppLog("[Tizen::Io] CreateSymbolicLink() succeeded."); diff --git a/src/Manager/SmackManager.cpp b/src/Manager/SmackManager.cpp index 49f3619..6b53753 100755 --- a/src/Manager/SmackManager.cpp +++ b/src/Manager/SmackManager.cpp @@ -135,15 +135,15 @@ SmackManager::AddLabelDir(const String& label, const String& dirPath, bool rootD std::unique_ptr<char[]> pRealPath(_StringConverter::CopyToCharArrayN(realPath)); TryReturn(pRealPath, false, "pRealPath is null"); - if ((rootDirectory == true) || (realPath.Contains(L"/shared/res") == true)) + if ((rootDirectory == true) || (dirPath.Contains(L"/shared/res") == true)) { res = AddLabelDir("_", pRealPath.get()); } - else if ((realPath.Contains(L"/shared/data") == true) || (realPath.Contains(L"/shared/trusted") == true)) + else if ((dirPath.Contains(L"/shared/data") == true) || (dirPath.Contains(L"/shared/trusted") == true)) { AddLabelSharedDir(L"", realPath); } - else if (realPath.Contains(L"shared") == true) + else if (dirPath.Contains(L"shared") == true) { res = AddLabelDir("*", pRealPath.get()); } @@ -159,6 +159,32 @@ SmackManager::AddLabelDir(const String& label, const String& dirPath, bool rootD } bool +SmackManager::AddLabelSymlink(const String& label, const String& symlink) +{ + if (__isSmackEnable == false) + { + return true; + } + + int res = 0; + + std::unique_ptr<char[]> pPath(_StringConverter::CopyToCharArrayN(symlink)); + TryReturn(pPath, false, "pPath is null."); + + if (InstallerUtil::IsSymlink(symlink) == true) + { + res = AddLabelDir("_", pPath.get()); + } + else + { + AppLog("[%ls] is not symlink.", pPath.get()); + return false; + } + + return true; +} + +bool SmackManager::AddLabelSharedDir(const PackageId& packageId, const String& dirPath) { if (__isSmackEnable == false) diff --git a/src/Manager/SmackManager.h b/src/Manager/SmackManager.h index 2a3f7e3..561c66a 100755 --- a/src/Manager/SmackManager.h +++ b/src/Manager/SmackManager.h @@ -38,6 +38,7 @@ public: bool Uninstall(const Tizen::App::PackageId& packageId); bool AddLabelDir(const Tizen::Base::String& label, const Tizen::Base::String& dirPath, bool rootDirectory = false); + bool AddLabelSymlink(const Tizen::Base::String& label, const Tizen::Base::String& symlink); bool AddLabelSharedDir(const Tizen::App::PackageId& packageId, const Tizen::Base::String& dirPath); bool AddSharedDirReaders(const Tizen::Base::String& label); bool AddFriend(const Tizen::App::PackageId& packageId1, const Tizen::App::PackageId& packageId2); diff --git a/src/Util/InstallerUtil.cpp b/src/Util/InstallerUtil.cpp index 7be47c6..e07ee81 100755 --- a/src/Util/InstallerUtil.cpp +++ b/src/Util/InstallerUtil.cpp @@ -237,7 +237,7 @@ InstallerUtil::GetRealPath(const String& filePath, String& realPath) } bool -InstallerUtil::CreateSymlink(const String& oldPath, const String& newPath) +InstallerUtil::CreateSymlink(const String& oldPath, const String& newPath, bool SmackLabelToRealPath) { int err = -1; bool res = false; @@ -260,7 +260,15 @@ InstallerUtil::CreateSymlink(const String& oldPath, const String& newPath) SmackManager smackManager; String label("_"); - smackManager.AddLabelDir(label, newPath); + + if (SmackLabelToRealPath == true) + { + smackManager.AddLabelDir(label, newPath); + } + else + { + smackManager.AddLabelSymlink(label, newPath); + } AppLog("CreateSymlink(): [%ls] -> [%ls]", newPath.GetPointer(), oldPath.GetPointer()); diff --git a/src/Util/InstallerUtil.h b/src/Util/InstallerUtil.h index 3246364..82c3d4e 100755 --- a/src/Util/InstallerUtil.h +++ b/src/Util/InstallerUtil.h @@ -56,7 +56,7 @@ public: static bool IsSymlink(const Tizen::Base::String& filePath); static bool GetRealPath(const Tizen::Base::String& filePath, Tizen::Base::String& realPath); - static bool CreateSymlink(const Tizen::Base::String& oldPath, const Tizen::Base::String& newPath); + static bool CreateSymlink(const Tizen::Base::String& oldPath, const Tizen::Base::String& newPath, bool SmackLabelToRealPath = true); 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 appOwner); |