* \brief preload request received from pkgmgr_installer
*/
Property<bool> is_preload_request;
+
+ /**
+ * \brief force-remove request received from pkgmgr_installer
+ */
+ Property<bool> force_remove;
};
} // namespace common_installer
true:false;
}
+bool PkgMgrInterface::GetIsForceRemoval() {
+ // root only
+ return (getuid() == 0 && pkgmgr_installer_get_force_removal(pi_) == 1);
+}
+
} // namespace common_installer
bool GetIsPreloadRequest();
/**
+ * Returns True if the request is for force-remove. Otherwise, return false
+ *
+ * \return True if the request is for force-remove. Otherwise, return false
+ */
+ bool GetIsForceRemoval();
+
+ /**
* Get Raw pointer to pkgmgr_installer object
* NOTE: It should not be used (PkgMgrInterface can destroy it
*
}
break;
case RequestType::Uninstall:
+ SetupIsForceRemoval();
context_->pkgid.set(pkgmgr_->GetRequestInfo());
context_->file_path.set(kStrEmpty);
break;
context_->is_preload_request.set(pkgmgr_->GetIsPreloadRequest());
}
+void StepConfigure::SetupIsForceRemoval() {
+ context_->force_remove.set(pkgmgr_->GetIsForceRemoval());
+}
+
} // namespace configuration
} // namespace common_installer
void SetupRequestType();
void SetupFileCreationMask();
void SetupIsPreloadRequest();
+ void SetupIsForceRemoval();
PkgMgrPtr pkgmgr_;
if (req_type == RequestType::ManifestDirectInstall ||
req_type == RequestType::ManifestDirectUpdate)
manifest->type = strdup("rpm");
+ if (!context_->is_preload_request.get()) {
+ LOG(ERROR) << "Non-preload rpm installation not allowed";
+ return false;
+ }
else
manifest->type = strdup("tpk");
} else {
namespace pkgmgr {
Step::Status StepCheckBlacklist::process() {
- if (context_->installation_mode.get() == InstallationMode::OFFLINE)
+ if (context_->installation_mode.get() == InstallationMode::OFFLINE ||
+ context_->is_preload_request.get())
return Status::OK;
bool result;
pkgmgr_client* pc = pkgmgr_client_new(PC_REQUEST);
namespace pkgmgr {
Step::Status StepCheckRemovable::process() {
- pkgmgrinfo_pkginfo_h handle;
+ if (context_->force_remove.get())
+ return Status::OK;
+ pkgmgrinfo_pkginfo_h handle;
int ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(context_->pkgid.get().c_str(),
context_->uid.get(), &handle);
if (ret != PMINFO_R_OK) {