X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fjobs%2Fwidget_install%2Ftask_smack.cpp;h=86dfbfd27273508b751285a865e2f5399efb1792;hb=7bd7b093dd5876db2d7ee1f49df1f7a03c451a55;hp=31ab40829154f68e67a17ed765826e62609f288f;hpb=ac98fb85f9d9b0d697e1366c8a706e51dd5f0bdd;p=framework%2Fweb%2Fwrt-installer.git diff --git a/src/jobs/widget_install/task_smack.cpp b/src/jobs/widget_install/task_smack.cpp index 31ab408..86dfbfd 100644 --- a/src/jobs/widget_install/task_smack.cpp +++ b/src/jobs/widget_install/task_smack.cpp @@ -91,8 +91,9 @@ void TaskSmack::StepSmackFolderLabeling() Jobs::WidgetInstall::TaskSmack::SmackFolderLabelingStep()"); #ifdef WRT_SMACK_ENABLED /* /opt/usr/apps/[pkgid] directory's label is "_" */ - if (PC_OPERATION_SUCCESS != app_label_dir("_", - m_context.locations->getPackageInstallationDir().c_str())) { + if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId, + m_context.locations->getPackageInstallationDir().c_str(), + APP_PATH_ANY_LABEL, "_")) { LogWarning("Add label to " << m_context.locations->getPackageInstallationDir()); } @@ -100,40 +101,41 @@ void TaskSmack::StepSmackFolderLabeling() /* res directory */ std::string resDir = m_context.locations->getPackageInstallationDir() + "/res"; - if (PC_OPERATION_SUCCESS != app_label_dir(m_pkgId, - resDir.c_str())) { + + if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId, resDir.c_str(), + APP_PATH_PRIVATE)) { LogWarning("Add label to " << resDir); } + /* data directory */ + if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId, + m_context.locations->getPrivateStorageDir().c_str(), + APP_PATH_PRIVATE)) { + LogWarning("Add label to " << m_context.locations->getPrivateStorageDir()); + } + /* for prealod */ if (m_context.mode.installTime == InstallMode::InstallTime::PRELOAD && m_context.mode.extension != InstallMode::ExtensionType::DIR) { - if (PC_OPERATION_SUCCESS != app_label_dir("_", - m_context.locations->getUserDataRootDir().c_str())) { - LogWarning("Add label to " << m_context.locations->getUserDataRootDir()); + if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId, + m_context.locations->getUserDataRootDir().c_str(), + APP_PATH_GROUP_RW, "_")) { } } - /* data directory */ - if (PC_OPERATION_SUCCESS != - app_label_dir(m_pkgId, - m_context.locations->getPrivateStorageDir().c_str())) - { - LogWarning("Add label to " << m_context.locations->getPrivateStorageDir()); - } - /* tmp directory */ - if (PC_OPERATION_SUCCESS != - app_label_dir(m_pkgId, - m_context.locations->getPrivateTempStorageDir().c_str())) + if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId, + m_context.locations->getPrivateTempStorageDir().c_str(), + APP_PATH_PRIVATE)) { LogWarning("Add label to " << m_context.locations->getPrivateTempStorageDir()); } /* bin directory */ - if (PC_OPERATION_SUCCESS != app_label_dir(m_pkgId, - m_context.locations->getBinaryDir().c_str())) { + if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId, + m_context.locations->getBinaryDir().c_str(), + APP_PATH_PRIVATE)) { LogWarning("Add label to " << m_context.locations->getBinaryDir()); } @@ -211,7 +213,6 @@ void TaskSmack::StepAbortSmack() #ifdef WRT_SMACK_ENABLED /* TODO : std::string id = DPL::ToUTF8String(m_context.widgetConfig.tzAppid); - std::string id = DPL::ToUTF8String(m_context.widgetConfig.tzPkgid); char* appId = NULL; appId = (char*)calloc(1, id.length() + 1); snprintf(appId, id.length() + 1, "%s", id.c_str()); @@ -237,16 +238,11 @@ void TaskSmack::StepSetEndofInstallation() bool TaskSmack::setLabelForSharedDir(const char* pkgId) { - /* shared directory */ - if (PC_OPERATION_SUCCESS != app_label_dir("*", - m_context.locations->getSharedRootDir().c_str())) { - return false; - } - /* shared/res directory */ - if (PC_OPERATION_SUCCESS != app_label_dir("_", - m_context.locations->getSharedResourceDir().c_str())) { - return false; + if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId, + m_context.locations->getSharedResourceDir().c_str(), + APP_PATH_ANY_LABEL, "_")) { + LogWarning("Add label to " << m_context.locations->getSharedResourceDir()); } /* shared/trusted directory */ @@ -264,40 +260,20 @@ bool TaskSmack::setLabelForSharedDir(const char* pkgId) LogDebug("sha1 label string : " << sha1String); - if (PC_OPERATION_SUCCESS != app_label_shared_dir(pkgId, - sha1String.c_str(), - m_context.locations->getSharedTrustedDir().c_str())) { - return false; + if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId, + m_context.locations->getSharedTrustedDir().c_str(), + APP_PATH_GROUP_RW, sha1String.c_str())) { + LogWarning("Add label to " << m_context.locations->getBinaryDir()); } } /* shared/data directory */ - std::string dataLabel = std::string(pkgId) + "_shareddata"; - TizenPkgIdList pkgList = WidgetDAOReadOnly::getTizenPkgidList(); - const char** pList = new (std::nothrow) const char*[pkgList.size() + 1]; - - int index = 0; - FOREACH(app, pkgList) { - std::string id = DPL::ToUTF8String(*app); - char *pId = new char[id.size() + 1]; - snprintf(pId, id.length() + 1, "%s", id.c_str()); - pList[index++] = pId; + if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId, + m_context.locations->getSharedDataDir().c_str(), + APP_PATH_PUBLIC_RO)) { + LogWarning("Add label to " << m_context.locations->getSharedDataDir()); } - pList[index] = NULL; - if (PC_OPERATION_SUCCESS != app_label_shared_dir(pkgId, - dataLabel.c_str(), - m_context.locations->getSharedDataDir().c_str())) { - freeList(pList); - return false; - } - if (PC_OPERATION_SUCCESS != app_label_shared_dir(pkgId, - "*", - m_context.locations->getSharedDataDir().c_str())) { - freeList(pList); - return false; - } - freeList(pList); return true; } } //namespace WidgetInstall