+ AddStep(&TaskSmack::SmackFolderLabelingStep);
+ AddStep(&TaskSmack::SmackPrivilegeStep);
+ AddStep(&TaskSmack::SmackTemporaryStep);
+}
+
+void TaskSmack::SmackFolderLabelingStep()
+{
+ LogInfo(
+ "----------------> SMACK: \
+ Jobs::WidgetInstall::TaskSmack::SmackFolderLabelingStep()");
+
+#ifdef WRT_SMACK_ENABLED
+ /* /opt/usr/apps/[pkgid] directory's label is "_" */
+ std::string tzPkgid = DPL::ToUTF8String(m_context.widgetConfig.tzPkgid);
+ if (PC_OPERATION_SUCCESS != app_label_dir("_",
+ m_context.locations->
+ getPackageInstallationDir().
+ c_str()))
+ {
+ LogError("Set smack failure. Failed to add label for app root directory");
+ ThrowMsg(Exceptions::NotAllowed, "Instalation failure. "
+ "Add Label failure");
+ }
+
+ /* res directory */
+ std::string resDir = m_context.locations->getPackageInstallationDir() +
+ "/res";
+ if (PC_OPERATION_SUCCESS != app_label_dir(tzPkgid.c_str(),
+ resDir.c_str()))
+ {
+ LogError("Set smack failure. Failed to add label for resource directory");
+ ThrowMsg(Exceptions::NotAllowed, "Instalation failure. "
+ "Add Label failure");
+ }
+
+ /* bin directory */
+ if (PC_OPERATION_SUCCESS != app_label_dir(tzPkgid.c_str(),
+ m_context.locations->getBinaryDir()
+ .c_str()))
+ {
+ LogError("Set smack failure. Failed to add label for binary directory");
+ ThrowMsg(Exceptions::NotAllowed, "Instalation failure. "
+ "Add Label failure");
+ }
+
+ /* data directory */
+ if (PC_OPERATION_SUCCESS != app_label_dir(tzPkgid.c_str(),
+ m_context.locations->
+ getPrivateStorageDir().c_str()))
+ {
+ LogError("Set smack failure. Failed to add label for private storage directory");
+ ThrowMsg(Exceptions::NotAllowed, "Instalation failure. "
+ "Add Label failure");
+ }
+
+#endif