switch (pkgmgr_installer_get_request_type(pi_)) {
case PKGMGR_REQ_INSTALL:
return PkgMgrInterface::Type::Install;
+ case PKGMGR_REQ_UPGRADE:
+ return PkgMgrInterface::Type::Update;
case PKGMGR_REQ_UNINSTALL:
return PkgMgrInterface::Type::Uninstall;
case PKGMGR_REQ_REINSTALL:
/** Request type received from pkgmgr_installer
*/
enum class Type {
- Unknown,
- Install,
- Uninstall,
- Reinstall
+ Unknown,
+ Install,
+ Update,
+ Uninstall,
+ Reinstall
};
/** Returns Request type passed from pkgmgr_installer
context_->file_path.set(pkgmgr->GetRequestInfo());
context_->pkgid.set(kStrEmpty);
break;
+ case PkgMgrInterface::Type::Update:
+ context_->file_path.set(pkgmgr->GetRequestInfo());
+ context_->pkgid.set(kStrEmpty);
+ break;
case PkgMgrInterface::Type::Uninstall:
context_->pkgid.set(pkgmgr->GetRequestInfo());
context_->file_path.set(kStrEmpty);
break;
default:
- // currently, only installation and uninstallation handled
// TODO(p.sikorski): should return unsupported, and display error
- LOG(ERROR) << "Only installation and uninstallation is now supported";
+ LOG(ERROR) <<
+ "Only installation, update and uninstallation is now supported";
return Status::ERROR;
break;
}
#include "common/pkgmgr_interface.h"
#include "common/app_installer.h"
#include "common/step/step_configure.h"
+#include "common/step/step_backup_icons.h"
+#include "common/step/step_backup_manifest.h"
#include "common/step/step_copy.h"
+#include "common/step/step_copy_backup.h"
#include "common/step/step_generate_xml.h"
+#include "common/step/step_old_manifest.h"
#include "common/step/step_parse.h"
#include "common/step/step_register_app.h"
#include "common/step/step_remove_files.h"
#include "common/step/step_check_signature.h"
#include "common/step/step_unregister_app.h"
#include "common/step/step_unzip.h"
+#include "common/step/step_update_app.h"
+#include "common/step/step_update_security.h"
#include "tpk/step/step_parse.h"
#include "tpk/step/step_create_symbolic_link.h"
#include "utils/logging.h"
case ci::PkgMgrInterface::Type::Install:
ret = Install();
break;
+ case ci::PkgMgrInterface::Type::Update:
+ ret = Update();
+ break;
case ci::PkgMgrInterface::Type::Uninstall:
ret = Uninstall();
break;
return ai.Run();
}
+int Task::Update() {
+ ci::AppInstaller ai(kPkgType);
+
+ ai.AddStep<ci::configure::StepConfigure>();
+ ai.AddStep<ci::unzip::StepUnzip>();
+ ai.AddStep<ci::signature::StepCheckSignature>();
+ ai.AddStep<tpk::step::StepParse>();
+ ai.AddStep<ci::old_manifest::StepOldManifest>();
+ ai.AddStep<ci::backup_manifest::StepBackupManifest>();
+ ai.AddStep<ci::backup_icons::StepBackupIcons>();
+ ai.AddStep<ci::copy_backup::StepCopyBackup>();
+ ai.AddStep<tpk::step::StepCreateSymbolicLink>();
+ ai.AddStep<ci::update_security::StepUpdateSecurity>();
+ ai.AddStep<ci::generate_xml::StepGenerateXml>();
+ ai.AddStep<ci::update_app::StepUpdateApplication>();
+
+ return ai.Run();
+}
+
int Task::Uninstall() {
ci::AppInstaller ai(kPkgType);
private:
int Install();
+ int Update();
int Uninstall();
int Reinstall();
}; // class Task
#include "common/app_installer.h"
#include "common/pkgmgr_interface.h"
#include "common/step/step_configure.h"
+#include "common/step/step_backup_manifest.h"
+#include "common/step/step_backup_icons.h"
#include "common/step/step_copy.h"
+#include "common/step/step_copy_backup.h"
#include "common/step/step_generate_xml.h"
#include "common/step/step_parse.h"
#include "common/step/step_register_app.h"
#include "common/step/step_remove_files.h"
#include "common/step/step_revoke_security.h"
#include "common/step/step_register_security.h"
+#include "common/step/step_old_manifest.h"
#include "common/step/step_check_signature.h"
#include "common/step/step_unregister_app.h"
#include "common/step/step_unzip.h"
+#include "common/step/step_update_app.h"
+#include "common/step/step_update_security.h"
#include "wgt/step/step_parse.h"
#include "wgt/step/step_create_symbolic_link.h"
LOG(ERROR) << "Cannot connect to PkgMgrInstaller";
return -result;
}
-
ci::PkgMgrPtr pkgmgr = ci::PkgMgrInterface::Instance();
ci::AppInstaller installer("wgt");
installer.AddStep<ci::security::StepRegisterSecurity>();
break;
}
+ case ci::PkgMgrInterface::Type::Update: {
+ installer.AddStep<ci::configure::StepConfigure>();
+ installer.AddStep<ci::unzip::StepUnzip>();
+ installer.AddStep<ci::signature::StepCheckSignature>();
+ installer.AddStep<wgt::parse::StepParse>();
+ installer.AddStep<ci::old_manifest::StepOldManifest>();
+ installer.AddStep<ci::backup_manifest::StepBackupManifest>();
+ installer.AddStep<ci::backup_icons::StepBackupIcons>();
+ installer.AddStep<ci::copy_backup::StepCopyBackup>();
+ installer.AddStep<wgt::symbolic_link::StepCreateSymbolicLink>();
+ installer.AddStep<ci::update_security::StepUpdateSecurity>();
+ installer.AddStep<ci::generate_xml::StepGenerateXml>();
+ installer.AddStep<ci::update_app::StepUpdateApplication>();
+ break;
+ }
case ci::PkgMgrInterface::Type::Uninstall: {
installer.AddStep<ci::configure::StepConfigure>();
installer.AddStep<ci::parse::StepParse>();