return tep_name_value;
}
+std::string QueryZipMountFile(const std::string& pkgid, uid_t uid) {
+ pkgmgrinfo_pkginfo_h package_info;
+ if (pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid.c_str(), uid, &package_info)
+ != PMINFO_R_OK)
+ return {};
+ char* zip_mount_file = nullptr;
+ int ret = pkgmgrinfo_pkginfo_get_zip_mount_file(package_info, &zip_mount_file);
+ if (ret != PMINFO_R_OK) {
+ LOG(DEBUG) << "pkgmgrinfo_pkginfo_get_zip_mount_file failed with error: "
+ << ret;
+ pkgmgrinfo_pkginfo_destroy_pkginfo(package_info);
+ return {};
+ }
+ std::string zip_mount_file_value;
+ if (zip_mount_file)
+ zip_mount_file_value = zip_mount_file;
+ pkgmgrinfo_pkginfo_destroy_pkginfo(package_info);
+ return zip_mount_file_value;
+}
+
bool QueryAppidsForPkgId(const std::string& pkg_id,
std::vector<std::string>* result, uid_t uid) {
pkgmgrinfo_pkginfo_h package_info;
/**
* \brief Adapter interface for external PkgMgr module used for getting
+ * zip mount path for given package
+ *
+ * @param pkgid package id
+ * @param uid user id
+ * @return path or empty
+ */
+std::string QueryZipMountFile(const std::string& pkgid, uid_t uid);
+
+/**
+ * \brief Adapter interface for external PkgMgr module used for getting
* list of appids for given package
*
* \param pkg_id[in] package pkgid
namespace common_installer {
namespace configuration {
+Step::Status StepBlockCrossUpdate::precheck() {
+ if (!context_->old_manifest_data.get()) {
+ LOG(ERROR) << "Old manifest data is missing";
+ return Status::INVALID_VALUE;
+ }
+ return Status::OK;
+}
+
Step::Status StepBlockCrossUpdate::process() {
- // TODO(t.iwanek): check for file is not the best method
- // information about if package was mount-installed should be stored in pkgmgr
- // database
bool is_mount_installed =
- bf::exists(GetZipPackageLocation(context_->pkg_path.get(),
- context_->pkgid.get()));
+ context_->old_manifest_data.get()->zip_mount_file != nullptr;
if (is_mount_installed) {
if (context_->request_type.get() == RequestType::Reinstall) {
LOG(ERROR) << "Reinstall / RDS mode is not allowed for "
Status process() override;
Status clean() override { return Status::OK; }
Status undo() override { return Status::OK; }
- Status precheck() override { return Status::OK; }
+ Status precheck() override;
SCOPE_LOG_TAG(BlockCrossUpdate)
};
}
if (manifest_location_ == ManifestLocation::INSTALLED) {
- // recovery tep value for installed package
+ // recovery of tep value for installed package
std::string old_tep =
QueryTepPath(context_->pkgid.get(), context_->uid.get());
if (!old_tep.empty())
manifest->tep_name = strdup(old_tep.c_str());
+
+ // recovery of zip mount file for installed package
+ std::string zip_mount_file =
+ QueryZipMountFile(context_->pkgid.get(), context_->uid.get());
+ if (!zip_mount_file.empty())
+ manifest->zip_mount_file = strdup(zip_mount_file.c_str());
}
// write pkgid for recovery file