#include <cstring>
#include "common/external_storage.h"
+#include "common/pkgmgr_query.h"
namespace {
namespace common_installer {
namespace filesystem {
+StepAcquireExternalStorage::StepAcquireExternalStorage(
+ InstallerContext* context, bool installed)
+ : Step(context),
+ installed_(installed) {
+}
+
Step::Status StepAcquireExternalStorage::precheck() {
if (!context_->manifest_data.get()) {
LOG(ERROR) << "Manifest data is empty";
Step::Status StepAcquireExternalStorage::process() {
manifest_x* manifest = context_->manifest_data.get();
- manifest_x* old_manifest = context_->old_manifest_data.get();
Storage storage = Storage::NONE;
// in case of update
- if (old_manifest) {
- storage = Storage::INTERNAL;
- if (old_manifest->installed_storage)
- if (!strcmp(old_manifest->installed_storage, kInstalledExternally))
- storage = Storage::EXTERNAL;
+ if (installed_) {
+ std::string storage_str = QueryStorageForPkgId(context_->pkgid.get(),
+ context_->uid.get());
+ if (!strcmp(storage_str.c_str(), kInstalledExternally))
+ storage = Storage::EXTERNAL;
+ else
+ storage = Storage::INTERNAL;
} else {
if (!strcmp(manifest->installlocation, kInternalOnly)) {
storage = Storage::INTERNAL;
public:
using Step::Step;
+ explicit StepAcquireExternalStorage(InstallerContext* context,
+ bool installed);
+
Status process() override;
Status clean() override { return Status::OK; }
Status undo() override { return Status::OK; }
Status precheck() override;
+ bool installed_;
+
STEP_NAME(AcquireExternalStorage)
};