}
if (pkgmgr_installer_get_request_type(pi_)
- == PKGMGR_REQ_MANIFEST_DIRECT_INSTALL) {
- /* Add restrictions for manifest direct install
- * - Directory should be located under /usr/apps/
- * - XML path should be located under /usr/share/packages/
- * - Directory name and xml name should be same */
- bf::path directory_path = pkgmgr_installer_get_directory_path(pi_);
- bf::path xml_path = pkgmgr_installer_get_xml_path(pi_);
-
- if (directory_path.empty() ||
- !bf::is_directory(directory_path) ||
- xml_path.empty() ||
- !bf::is_regular_file(xml_path)) {
- LOG(ERROR) << "invalid parameter";
- return EINVAL;
- }
-
- if (directory_path.parent_path().compare("/usr/apps") != 0) {
- LOG(ERROR) << "invalid directory path";
- return EINVAL;
- }
-
- if (xml_path.parent_path().compare("/usr/share/packages") != 0) {
- LOG(ERROR) << "invalid xml path";
- return EINVAL;
- }
-
- if (directory_path.filename().string()
- .compare(xml_path.stem().string()) != 0) {
- LOG(ERROR) << "invalid parameter: directory path "
- << directory_path
- << "xml path"
- << xml_path;
- return EINVAL;
- }
-
+ == PKGMGR_REQ_MANIFEST_DIRECT_INSTALL) {
// pkgid should be exists in preload app list
std::ifstream preload_list("/etc/package-manager/preload/preload_list.txt");
bool is_preload_app = false;
for (std::string str; std::getline(preload_list, str); ) {
- if (str.compare(directory_path.filename().string()) == 0) {
+ if (str == GetRequestInfo()) {
is_preload_app = true;
break;
}
preload_list.close();
if (!is_preload_app) {
- LOG(ERROR) << "Only preload app could be installed by manifest direct install";
+ LOG(ERROR) <<
+ "Only preload app could be installed by manifest direct install";
return EINVAL;
}
}
-
is_app_installed_ = false;
if (query_interface_)
is_app_installed_ = query_interface_->IsAppInstalledByArgv(argc, argv);
return (pkgmgr_installer_get_tep_move_type(pi_) == 1)?true:false;
}
-boost::filesystem::path PkgMgrInterface::GetXMLPath() {
- return boost::filesystem::path(pkgmgr_installer_get_xml_path(pi_));
-}
-
-boost::filesystem::path PkgMgrInterface::GetDirectoryPath() {
- return boost::filesystem::path(pkgmgr_installer_get_directory_path(pi_));
-}
-
} // namespace common_installer
const char *GetRequestInfo() const;
/**
- * Returns XML path passed from pkgmgr_installer
- *
- * \return XML info retrieved from pkgmgr_installer
- */
- boost::filesystem::path GetXMLPath();
-
- /**
- * Returns directory path passed from pkgmgr_installer
- *
- * \return Directory info retrieved from pkgmgr_installer
- */
- boost::filesystem::path GetDirectoryPath();
-
- /**
* Creates PkgMgrInterface
*
* \param argc main() argc argument passed to the backend
#include "common/step/step_configure.h"
+#include <boost/filesystem/path.hpp>
+
+#include <pkgmgr-info.h>
#include <sys/stat.h>
#include <tzplatform_config.h>
#include <string>
#include "common/request.h"
#include "common/utils/file_util.h"
+namespace bf = boost::filesystem;
+
namespace common_installer {
namespace configuration {
-const char *kStrEmpty = "";
+const char kRpmPackageType[] = "rpm";
+const char kStrEmpty[] = "";
StepConfigure::StepConfigure(InstallerContext* context, PkgMgrPtr pkgmgr)
: Step(context),
context_->pkgid.set(kStrEmpty);
break;
case RequestType::ManifestDirectInstall:
- case RequestType::ManifestDirectUpdate:
+ case RequestType::ManifestDirectUpdate: {
if (context_->request_mode.get() != RequestMode::GLOBAL) {
LOG(ERROR) <<
"Only global user allows to use Manifest Direct Install";
return Status::CONFIG_ERROR;
}
- context_->xml_path.set(pkgmgr_->GetXMLPath());
- context_->pkgid.set(context_->xml_path.get().stem().string());
- context_->unpacked_dir_path.set(pkgmgr_->GetDirectoryPath());
- context_->pkg_path.set(pkgmgr_->GetDirectoryPath());
+ context_->pkgid.set(pkgmgr_->GetRequestInfo());
+ bf::path package_directory =
+ context_->root_application_path.get() / context_->pkgid.get();
+ bf::path xml_path = bf::path(getUserManifestPath(context_->uid.get()))
+ / bf::path(context_->pkgid.get());
+ xml_path += ".xml";
+ context_->unpacked_dir_path.set(package_directory);
+ context_->pkg_path.set(package_directory);
+ context_->xml_path.set(xml_path);
context_->privilege_level.set(common_installer::PrivilegeLevel::PUBLIC);
- context_->pkg_type.set("rpm"); // temporary fix as rpm
+ context_->pkg_type.set(kRpmPackageType); // temporary fix as rpm
break;
+ }
default:
// TODO(p.sikorski): should return unsupported, and display error
LOG(ERROR) <<