<listOptionValue builtIn="false" value=""../../../src/system/inc""/>
<listOptionValue builtIn="false" value=""../../../src/security/inc""/>
<listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/pkgmgr""/>
+ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/dlog""/>
<listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/system""/>
+ <listOptionValue builtIn="false" value="../../osp-foundation/src/base/inc"/>
+ <listOptionValue builtIn="false" value="../../osp-foundation/src/app/inc"/>
+ <listOptionValue builtIn="false" value=""../../osp-foundation/src/system/inc""/>
+ <listOptionValue builtIn="false" value=""../../osp-foundation/src/security/inc""/>
+ <listOptionValue builtIn="false" value=""../../osp-foundation/src/io/inc""/>
</option>
<option id="sbi.gnu.cpp.compiler.option.frameworks_inc.cpp.1460003629" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.cpp.compiler.option.frameworks_inc.cpp" valueType="includePath">
<listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include""/>
#define DIR_MEMORYCARD_OSP_APPLICATIONS_TEMP L"/opt/storage/sdcard/apps/__@@osp_tmp@@__"
#define OSP_INSTALLER "osp-installer"
-#define OSP_INSTALLER_VERSION "osp-installer version = 2012/10/18"
+#define OSP_INSTALLER_VERSION "osp-installer version = 2012/10/18(10)"
enum InstallationSetStep
{
INSTALLER_STEP_INIT,
INSTALLER_STEP_CHECK_SYSTEM,
INSTALLER_STEP_CHECK_PACKAGE,
+ INSTALLER_STEP_DRM,
INSTALLER_STEP_PARSE_MANIFEST,
INSTALLER_STEP_UNPACK,
INSTALLER_STEP_LICENSE,
- INSTALLER_STEP_DRM,
INSTALLER_STEP_PARSE_SIGNATURE,
INSTALLER_STEP_INIT_UNINSTALL,
INSTALLER_ERROR_CERT_CHAIN,
INSTALLER_ERROR_CERT_REVOKED,
INSTALLER_ERROR_CERT_ROOT,
- INSTALLER_ERROR_DRM_LICENSE,
+ INSTALLER_ERROR_DRM,
INSTALLER_ERROR_INTEGRITY_FAILED,
};
String binaryPath;
binaryPath.Format(1024, L"%ls%ls/%ls", rootPath.GetPointer(), DIR_BIN, appName.GetPointer());
+ String tempBinaryPath;
+ tempBinaryPath.Format(1024, L"%ls%ls/.%ls", rootPath.GetPointer(), DIR_BIN, appName.GetPointer());
+
pBinaryPath = _StringConverter::CopyToCharArrayN(binaryPath);
TryCatch(pBinaryPath, res = false, "[osp-installer] pBinaryPath is null");
r = File::Copy(UIAPP_LOADER_PATH, pBinaryPath, false);
TryCatch(!IsFailed(r), res = false, "[osp-installer] File::Copy() failed, filePath=[%s]", pBinaryPath);
+ InstallerUtil::Copy(UIAPP_LOADER_PATH, tempBinaryPath);
+
ArrayList* pFeatureList = pAppInfoImpl->GetAppFeatureList();
TryCatch(pFeatureList, res = false, "[osp-installer] pFeatureList is null");
if (pContext->IsPreloaded() == false)
{
//err = symlink(SERVICEAPP_LOADER_PATH, pBinaryPath);
+
+ InstallerUtil::Copy(SERVICEAPP_LOADER_PATH, tempBinaryPath);
+
r = File::Copy(SERVICEAPP_LOADER_PATH, pBinaryPath, false);
TryCatch(!IsFailed(r), res = false, "[osp-installer] File::Copy() failed, filePath=[%s]", pBinaryPath);
}
else
{
//err = symlink(SYSTEMAPP_LOADER_PATH, pBinaryPath);
+
+ InstallerUtil::Copy(SYSTEMAPP_LOADER_PATH, tempBinaryPath);
+
r = File::Copy(SYSTEMAPP_LOADER_PATH, pBinaryPath, false);
TryCatch(!IsFailed(r), res = false, "[osp-installer] File::Copy() failed, filePath=[%s]", pBinaryPath);
}
{
}
-bool
-PermissionManager::ChangeOwner(const Osp::Base::String& filePath)
-{
- int res = -1;
- char* pFilePath = null;
-
- pFilePath = _StringConverter::CopyToCharArrayN(filePath);
- TryReturn(pFilePath, false, "[osp-installer] pFilePath is null");
-
- res = chown(pFilePath, APP_OWNER_ID, APP_GROUP_ID);
- if (res != 0)
- {
- AppLogTag(OSP_INSTALLER, "Fail to change owner[%s], res=[%d]", pFilePath, res);
- }
-
- delete[] pFilePath;
-
- return true;
-}
+//bool
+//PermissionManager::ChangeOwner(const Osp::Base::String& filePath)
+//{
+// int res = -1;
+// char* pFilePath = null;
+//
+// pFilePath = _StringConverter::CopyToCharArrayN(filePath);
+// TryReturn(pFilePath, false, "[osp-installer] pFilePath is null");
+//
+// res = chown(pFilePath, APP_OWNER_ID, APP_GROUP_ID);
+// if (res != 0)
+// {
+// AppLogTag(OSP_INSTALLER, "Fail to change owner[%s], res=[%d]", pFilePath, res);
+// }
+//
+// delete[] pFilePath;
+//
+// return true;
+//}
bool
PermissionManager::ChangeHomeDirectoryOwner(const String& rootPath, int depth)
if (entryName == L".")
{
- ChangeOwner(entryDir);
- ChangeMode(entryDir, S_IRUSR | S_IWUSR | S_IXUSR);
+ InstallerUtil::ChangeOwner(entryDir);
+ InstallerUtil::ChangeMode(entryDir, S_IRUSR | S_IWUSR | S_IXUSR);
continue;
}
else if (entryName == L"..")
if (entry.IsDirectory() == false)
{
- ChangeOwner(entryDir);
- ChangeMode(entryDir, S_IRUSR | S_IWUSR | S_IXUSR);
+ InstallerUtil::ChangeOwner(entryDir);
+ InstallerUtil::ChangeMode(entryDir, S_IRUSR | S_IWUSR | S_IXUSR);
}
else
{
ChangeHomeDirectoryOwner(entryDir, depth+1);
- ChangeMode(entryDir, S_IRUSR | S_IWUSR | S_IXUSR);
+ InstallerUtil::ChangeMode(entryDir, S_IRUSR | S_IWUSR | S_IXUSR);
}
}
// }
ChangeHomeDirectoryOwner(dataPath, 0);
- ChangeMode(dataPath, S_IRUSR | S_IWUSR | S_IXUSR);
+ InstallerUtil::ChangeMode(dataPath, S_IRUSR | S_IWUSR | S_IXUSR);
return true;
}
-bool
-PermissionManager::ChangeMode(const String& filePath, int mode)
-{
- int res = -1;
- char* pFilePath = null;
-
- pFilePath = _StringConverter::CopyToCharArrayN(filePath);
- TryReturn(pFilePath, false, "[osp-installer] pFilePath is null");
-
- res = chmod(pFilePath, mode);
- if (res != 0)
- {
- AppLogTag(OSP_INSTALLER, "Fail to change mode, path=[%s], mode=[%o], res=[%d]", pFilePath, mode, res);
- }
-
- delete[] pFilePath;
-
- return true;
-}
+//bool
+//PermissionManager::ChangeMode(const String& filePath, int mode)
+//{
+// int res = -1;
+// char* pFilePath = null;
+//
+// pFilePath = _StringConverter::CopyToCharArrayN(filePath);
+// TryReturn(pFilePath, false, "[osp-installer] pFilePath is null");
+//
+// res = chmod(pFilePath, mode);
+// if (res != 0)
+// {
+// AppLogTag(OSP_INSTALLER, "Fail to change mode, path=[%s], mode=[%o], res=[%d]", pFilePath, mode, res);
+// }
+//
+// delete[] pFilePath;
+//
+// return true;
+//}
bool
PermissionManager::SetDirectory(InstallationContext* pContext)
if (r == E_SUCCESS)
{
ChangeHomeDirectoryOwner(destPath, 0);
- ChangeMode(destPath, S_IRUSR | S_IXUSR);
+ InstallerUtil::ChangeMode(destPath, S_IRUSR | S_IXUSR);
}
sprintf(destPath, "%ls%ls", appRootPath.GetPointer(), DIR_DATA);
if (r == E_SUCCESS)
{
ChangeHomeDirectoryOwner(destPath, 0);
- ChangeMode(destPath, S_IRUSR | S_IWUSR | S_IXUSR);
+ InstallerUtil::ChangeMode(destPath, S_IRUSR | S_IWUSR | S_IXUSR);
}
sprintf(destPath, "%ls%ls", appRootPath.GetPointer(), DIR_SETTING);
}
ChangeHomeDirectoryOwner(destPath, 0);
- ChangeMode(destPath, S_IRUSR | S_IWUSR | S_IXUSR);
+ InstallerUtil::ChangeMode(destPath, S_IRUSR | S_IWUSR | S_IXUSR);
}
ApplyHomeDirectoryPolicy(appRootPath);
static bool SetFile(InstallationContext* pContext);
private:
- static bool ChangeOwner(const Osp::Base::String& filePath);
+ // static bool ChangeOwner(const Osp::Base::String& filePath);
static bool ChangeHomeDirectoryOwner(const Osp::Base::String&, int depth);
static bool ApplyHomeDirectoryPolicy(const Osp::Base::String& rootpath);
- static bool ChangeMode(const Osp::Base::String& filePath, int mode);
+ // static bool ChangeMode(const Osp::Base::String& filePath, int mode);
static bool CreateSystemDirectory(InstallationContext* pContext, const Osp::Base::String& rootpath);
static bool SetSymLink(InstallationContext* pContext);
static bool PrepareDataCaging(InstallationContext* pContext);
#include "InstallationContext.h"
#include "PackageCheckStep.h"
+#include "InstallerUtil.h"
using namespace Osp::Base;
using namespace Osp::Base::Utility;
PackageCheckStep::OnStatePackageCheck(void)
{
InstallerError error = INSTALLER_ERROR_NONE;
- AppLogTag(OSP_INSTALLER, "SignatureStep::OnStatePackageCheck()");
+ AppLogTag(OSP_INSTALLER, "PackageCheckStep::OnStatePackageCheck()");
String tempDir;
TryReturn(!IsFailed(r), INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] Directory::Create() failed");
}
+ String packagePath = __pContext->GetPackagePath();
+ if (InstallerUtil::IsDrmFile(packagePath) == true)
+ {
+ bool res = false;
+ res = InstallerUtil::DecryptPackage(packagePath);
+ TryReturn(res == true, INSTALLER_ERROR_DRM, "[osp-installer] InstallerUtil::DecryptPackage() failed");
+ }
+
FileUnzipper unzipper;
- unzipper.Construct(__pContext->GetPackagePath());
+ unzipper.Construct(packagePath);
AppLogTag(OSP_INSTALLER, "UnzipTo(manifest.xml) - START");
unzipper.UnzipTo(tempDir, L"info/manifest.xml");
#include <sys/stat.h>
#include <dirent.h>
#include <unistd.h>
+#include <unique_ptr.h>
#include <FBaseErrorDefine.h>
#include <FIoFile.h>
err = lstat(pFilePath, &fileinfo);
TryCatch(err >= 0, res = false, "[osp-installer] lstat() failed, pFilePath=%s", pFilePath);
+
if (S_ISLNK(fileinfo.st_mode))
{
AppLogTag(OSP_INSTALLER, "remove symlink, pFilePath=%s", pFilePath);
return res;
}
+bool
+InstallerUtil::Copy(const String& srcFilePath, const String& destFilePath)
+{
+ const int bufSize = 4096;
+ int readBytes = 0;
+ result r = E_SUCCESS;
+
+ File srcFile;
+ File destFile;
+
+ std::unique_ptr<char[]> pBuf(new char[bufSize]);
+ TryReturn(pBuf, false, "[osp-installer] pBuf is null");
+
+ r = srcFile.Construct(srcFilePath, L"r");
+ TryReturn(!IsFailed(r), false, "[osp-installer] srcFile.Construct is failed");
+
+ r = destFile.Construct(destFilePath, L"w");
+ TryReturn(!IsFailed(r), false, "[osp-installer] destFile.Construct is failed");
+
+ do
+ {
+ readBytes = srcFile.Read(pBuf.get(), bufSize);
+ if (readBytes > 0)
+ {
+ r = destFile.Write(pBuf.get(), readBytes);
+ TryReturn(!IsFailed(r), false, "[osp-installer] destFile.Write is failed");
+ }
+ }
+ while (readBytes > 0);
+
+ return true;
+}
+
+bool
+InstallerUtil::CreateSymlink(const String& oldPath, const String& newPath)
+{
+ int err = -1;
+
+ std::unique_ptr<char[]> pOldPath(_StringConverter::CopyToCharArrayN(oldPath));
+ TryReturn(pOldPath, false, "[osp-installer] pOldPath is null");
+
+ std::unique_ptr<char[]> pNewPath(_StringConverter::CopyToCharArrayN(newPath));
+ TryReturn(pNewPath, false, "[osp-installer] pNewPath is null");
+
+ err = symlink(pOldPath.get(), pNewPath.get());
+ TryReturn(err == 0, false, "[osp-installer] symlink() is failed, oldpath=(%s), newpath=(%s)", pOldPath.get(), pNewPath.get());
+
+ return true;
+}
+
+bool
+InstallerUtil::ChangeMode(const String& filePath, int mode)
+{
+ int err = -1;
+
+ std::unique_ptr<char[]> pFilePath(_StringConverter::CopyToCharArrayN(filePath));
+ TryReturn(pFilePath, false, "[osp-installer] pFilePath is null");
+
+ err = chmod(pFilePath.get(), mode);
+ TryReturn(err == 0, false, "[osp-installer] chmod() is failed, filepath=[%s], mode=[%o]", pFilePath.get(), mode);
+
+ return true;
+}
+
+bool
+InstallerUtil::ChangeOwner(const String& filePath)
+{
+ int err = -1;
+
+ std::unique_ptr<char[]> pFilePath(_StringConverter::CopyToCharArrayN(filePath));
+ TryReturn(pFilePath, false, "[osp-installer] pFilePath is null");
+
+ err = chown(pFilePath.get(), APP_OWNER_ID, APP_GROUP_ID);
+ TryReturn(err == 0, false, "[osp-installer] chown() is failed, filepath=[%s]", pFilePath.get());
+
+ return true;
+}
+
+bool
+InstallerUtil::IsDrmFile(const Osp::Base::String& packagePath)
+{
+ AppLogTag(OSP_INSTALLER, "IsDrmFile() called, packagePath=%ls", packagePath.GetPointer());
+ return false;
+}
+
+bool
+InstallerUtil::DecryptPackage(const Osp::Base::String& packagePath)
+{
+ AppLogTag(OSP_INSTALLER, "DecryptPackage() called, packagePath=%ls", packagePath.GetPointer());
+ return true;
+}
+
String
InstallerUtil::GetCategory(int categoryType)
{
virtual ~InstallerUtil(void);
static bool Remove(const Osp::Base::String& filePath);
+ static bool Copy(const Osp::Base::String& srcFilePath, const Osp::Base::String& destFilePath);
+
+ static bool CreateSymlink(const Osp::Base::String& oldPath, const Osp::Base::String& newPath);
+ static bool ChangeMode(const Osp::Base::String& filePath, int mode);
+ static bool ChangeOwner(const Osp::Base::String& filePath);
+
+ static bool IsDrmFile(const Osp::Base::String& packagePath);
+ static bool DecryptPackage(const Osp::Base::String& packagePath);
static Osp::Base::String GetCategory(int categoryType);
static CategoryType GetCategoryType(char* pCategory);