m_context.locationType) {
AddStep(&TaskFileManipulation::StepCreateDirs);
AddStep(&TaskFileManipulation::StepCreatePrivateStorageDir);
- AddStep(&TaskFileManipulation::StepCreateShareDir);
if (m_context.widgetConfig.packagingType !=
WrtDB::PKG_TYPE_DIRECTORY_WEB_APP)
{
AddStep(&TaskFileManipulation::StepPrepareExternalDir);
AddStep(&TaskFileManipulation::StepInstallToExternal);
AddStep(&TaskFileManipulation::StepCreatePrivateStorageDir);
- AddStep(&TaskFileManipulation::StepCreateShareDir);
AddAbortStep(&TaskFileManipulation::StepAbortCreateExternalDir);
}
}
}
-void TaskFileManipulation::StepCreateShareDir()
-{
- std::string sharePath = m_context.locations->getShareDir();
-
- if (euidaccess(sharePath.c_str(), F_OK) != 0) {
- if(!WrtUtilMakeDir(sharePath, SHARE_MODE)){
- LogError("Failed to create directory for share");
- ThrowMsg(Exceptions::InternalError,
- "Failed to create directory for share");
- }
- // '5000' is default uid, gid for applications.
- // So installed applications should be launched as process of uid '5000'.
- // the process can access private directory 'data' of itself.
- if(chown(sharePath.c_str(),
- WEBAPP_DEFAULT_UID,
- WEBAPP_DEFAULT_GID) != 0)
- {
- ThrowMsg(Exceptions::InternalError,
- "Chown to invaild user");
- }
- } else if (euidaccess(sharePath.c_str(), W_OK | R_OK | X_OK) == 0) {
- LogInfo("Share directory already exists.");
- // Even if share directory already is created, share dircetory
- // should change owner.
- if(chown(sharePath.c_str(),
- WEBAPP_DEFAULT_UID,
- WEBAPP_DEFAULT_GID) != 0)
- {
- ThrowMsg(Exceptions::InternalError,
- "Chown to invaild user");
- }
- if(chmod(sharePath.c_str(), SHARE_MODE) != 0) {
- ThrowMsg(Exceptions::InternalError,
- "chmod to 0700");
- }
-
- } else {
- ThrowMsg(Exceptions::InternalError,
- "No access to private storage.");
- }
-
-}
-
void TaskFileManipulation::StepRenamePath()
{
std::string instDir;