// found in the LICENSE file.
#include "wgt/wgt_installer.h"
-#include "wgt/shared_dirs.h"
#include <common/pkgmgr_interface.h>
#include <common/step/filesystem/step_delta_patch.h>
#include <common/step/filesystem/step_disable_external_mount.h>
#include <common/step/filesystem/step_enable_external_mount.h>
+#include <common/step/filesystem/step_migrate_legacy_external_image.h>
#include <common/step/filesystem/step_move_installed_storage.h>
#include <common/step/filesystem/step_recover_change_owner.h>
#include <common/step/filesystem/step_recover_files.h>
#include <common/step/filesystem/step_recover_manifest.h>
#include <common/step/filesystem/step_recover_external_storage.h>
#include <common/step/filesystem/step_recover_storage_directories.h>
+#include <common/step/filesystem/step_recover_per_user_storage_directories.h>
#include <common/step/filesystem/step_remove_files.h>
#include <common/step/filesystem/step_remove_icons.h>
#include <common/step/filesystem/step_remove_globalapp_symlinks.h>
#include <wgt_manifest_handlers/widget_config_parser.h>
+#include "wgt/shared_dirs.h"
#include "wgt/step/configuration/step_check_rds_manifest.h"
#include "wgt/step/configuration/step_check_start_files.h"
#include "wgt/step/configuration/step_parse.h"
#include "wgt/step/filesystem/step_wgt_patch_storage_directories.h"
#include "wgt/step/filesystem/step_wgt_prepare_package_directory.h"
#include "wgt/step/filesystem/step_wgt_resource_directory.h"
+#include "wgt/step/filesystem/step_wgt_undo_patch_storage_directories.h"
#include "wgt/step/filesystem/step_wgt_update_package_directory.h"
#include "wgt/step/pkgmgr/step_generate_xml.h"
#include "wgt/step/security/step_add_default_privileges.h"
/* treat the request */
switch (pkgmgr_->GetRequestType()) {
case ci::RequestType::Install : {
+ InstallSteps();
+ break;
+ }
+ case ci::RequestType::Update: {
+ UpdateSteps();
+ break;
+ }
+ case ci::RequestType::Uninstall: {
+ UninstallSteps();
+ break;
+ }
+ case ci::RequestType::Reinstall: {
+ ReinstallSteps();
+ break;
+ }
+ case ci::RequestType::Delta: {
+ DeltaSteps();
+ break;
+ }
+ case ci::RequestType::Recovery: {
+ RecoverySteps();
+ break;
+ }
+ case ci::RequestType::MountInstall: {
+ MountInstallSteps();
+ break;
+ }
+ case ci::RequestType::MountUpdate: {
+ MountUpdateSteps();
+ break;
+ }
+ case ci::RequestType::ManifestDirectInstall: {
+ ManifestDirectInstallSteps();
+ break;
+ }
+ case ci::RequestType::ManifestDirectUpdate: {
+ ManifestDirectUpdateSteps();
+ break;
+ }
+ case ci::RequestType::ReadonlyUpdateInstall: {
+ ReadonlyUpdateInstallSteps();
+ break;
+ }
+ case ci::RequestType::ReadonlyUpdateUninstall: {
+ ReadonlyUpdateUninstallSteps();
+ break;
+ }
+ case ci::RequestType::ManifestPartialInstall: {
+ ManifestPartialInstallSteps();
+ break;
+ }
+ case ci::RequestType::ManifestPartialUpdate: {
+ ManifestPartialUpdateSteps();
+ break;
+ }
+ case ci::RequestType::PartialUninstall: {
+ ManifestPartialUninstallSteps();
+ break;
+ }
+ case ci::RequestType::Move: {
+ MoveSteps();
+ break;
+ }
+ case ci::RequestType::EnablePkg: {
+ EnablePkgSteps();
+ break;
+ }
+ case ci::RequestType::DisablePkg: {
+ DisablePkgSteps();
+ break;
+ }
+ case ci::RequestType::MigrateExtImg: {
+ MigrateExtImgSteps();
+ break;
+ }
+ default: {
+ DefaultSteps();
+ }
+ }
+}
+ void WgtInstaller::InstallSteps() {
AddStep<ci::configuration::StepConfigure>(pkgmgr_);
AddStep<ci::filesystem::StepUnzip>();
AddStep<wgt::configuration::StepParse>(
AddStep<wgt::filesystem::StepCopyPreviewIcons>();
AddStep<wgt::security::StepCheckExtensionPrivileges>();
AddStep<wgt::pkgmgr::StepGenerateXml>();
- AddStep<ci::security::StepRegisterSecurity>();
AddStep<ci::pkgmgr::StepRegisterApplication>();
+ AddStep<ci::security::StepRegisterSecurity>();
AddStep<ci::pkgmgr::StepRunParserPlugin>(
ci::Plugin::ActionType::Install);
AddStep<ci::filesystem::StepCreatePerUserStorageDirectories>(
wgt::filesystem::WgtAdditionalSharedDirs);
AddStep<ci::filesystem::StepChangeOwnershipAndPermission>();
AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
- break;
- }
- case ci::RequestType::Update: {
+ }
+
+ void WgtInstaller::UpdateSteps() {
AddStep<ci::configuration::StepConfigure>(pkgmgr_);
AddStep<ci::filesystem::StepUnzip>();
AddStep<wgt::configuration::StepParse>(
AddStep<wgt::filesystem::StepCopyPreviewIcons>();
AddStep<ci::filesystem::StepCopyStorageDirectories>();
AddStep<wgt::security::StepCheckExtensionPrivileges>();
- AddStep<ci::security::StepUpdateSecurity>();
AddStep<wgt::pkgmgr::StepGenerateXml>();
AddStep<ci::pkgmgr::StepUpdateApplication>();
+ AddStep<ci::security::StepUpdateSecurity>();
AddStep<ci::pkgmgr::StepRunParserPlugin>(
ci::Plugin::ActionType::Upgrade);
AddStep<ci::filesystem::StepChangeOwnershipAndPermission>();
AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
- break;
- }
- case ci::RequestType::Uninstall: {
+ }
+
+ void WgtInstaller::UninstallSteps() {
AddStep<ci::configuration::StepConfigure>(pkgmgr_);
AddStep<ci::pkgmgr::StepCheckRestriction>();
AddStep<ci::pkgmgr::StepCheckRemovable>();
AddStep<ci::security::StepRevokeSecurity>();
AddStep<ci::pkgmgr::StepRemoveManifest>();
AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
- break;
- }
- case ci::RequestType::Reinstall: {
+ }
+
+ void WgtInstaller::ReinstallSteps() {
AddStep<ci::configuration::StepConfigure>(pkgmgr_);
AddStep<wgt::configuration::StepCheckRDSManifest>();
AddStep<wgt::configuration::StepParse>(
AddStep<ci::security::StepUpdateSecurity>();
AddStep<ci::filesystem::StepChangeOwnershipAndPermission>();
AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
- break;
- }
- case ci::RequestType::Delta: {
+ }
+
+ void WgtInstaller::DeltaSteps() {
AddStep<ci::configuration::StepConfigure>(pkgmgr_);
AddStep<ci::filesystem::StepUnzip>();
AddStep<wgt::configuration::StepParse>(
AddStep<ci::configuration::StepParsePreload>();
AddStep<ci::configuration::StepCheckTizenVersion>();
AddStep<ci::filesystem::StepEnableExternalMount>();
+ AddStep<wgt::filesystem::StepWgtUndoPatchStorageDirectories>();
AddStep<ci::filesystem::StepDeltaPatch>("res/wgt/");
AddStep<ci::filesystem::StepDisableExternalMount>();
AddStep<wgt::configuration::StepCheckStartFiles>();
AddStep<wgt::filesystem::StepCopyPreviewIcons>();
AddStep<ci::filesystem::StepCopyStorageDirectories>();
AddStep<wgt::security::StepCheckExtensionPrivileges>();
- AddStep<ci::security::StepUpdateSecurity>();
AddStep<wgt::pkgmgr::StepGenerateXml>();
AddStep<ci::pkgmgr::StepUpdateApplication>();
+ AddStep<ci::security::StepUpdateSecurity>();
AddStep<ci::pkgmgr::StepRunParserPlugin>(
ci::Plugin::ActionType::Upgrade);
AddStep<ci::filesystem::StepChangeOwnershipAndPermission>();
AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
- break;
- }
- case ci::RequestType::Recovery: {
+ }
+
+ void WgtInstaller::RecoverySteps() {
AddStep<ci::configuration::StepConfigure>(pkgmgr_);
AddStep<ci::recovery::StepOpenRecoveryFile>();
AddStep<ci::configuration::StepParseManifest>(
AddStep<ci::filesystem::StepRecoverManifest>();
AddStep<ci::filesystem::StepRecoverExternalStorage>();
AddStep<ci::filesystem::StepRecoverStorageDirectories>();
+ AddStep<ci::filesystem::StepRecoverPerUserStorageDirectories>();
AddStep<ci::filesystem::StepRecoverFiles>();
AddStep<ci::mount::StepMountRecover>();
AddStep<wgt::security::StepWgtRecoverSignature>();
- AddStep<ci::pkgmgr::StepRecoverApplication>();
AddStep<ci::filesystem::StepRecoverChangeOwner>();
AddStep<ci::security::StepRecoverSecurity>();
- break;
- }
- case ci::RequestType::MountInstall: {
+ AddStep<ci::pkgmgr::StepRecoverApplication>();
+ }
+
+ void WgtInstaller::MountInstallSteps() {
AddStep<ci::configuration::StepConfigure>(pkgmgr_);
AddStep<ci::mount::StepMountUnpacked>();
AddStep<wgt::configuration::StepParse>(
AddStep<wgt::filesystem::StepCopyPreviewIcons>();
AddStep<wgt::pkgmgr::StepGenerateXml>();
AddStep<wgt::security::StepCheckExtensionPrivileges>();
- AddStep<ci::security::StepRegisterSecurity>();
AddStep<ci::pkgmgr::StepRegisterApplication>();
+ AddStep<ci::security::StepRegisterSecurity>();
AddStep<ci::pkgmgr::StepRunParserPlugin>(
ci::Plugin::ActionType::Install);
AddStep<ci::filesystem::StepCreatePerUserStorageDirectories>(
wgt::filesystem::WgtAdditionalSharedDirs);
AddStep<ci::filesystem::StepChangeOwnershipAndPermission>();
AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
- break;
- }
- case ci::RequestType::MountUpdate: {
+ }
+
+ void WgtInstaller::MountUpdateSteps() {
AddStep<ci::configuration::StepConfigure>(pkgmgr_);
AddStep<ci::mount::StepMountUnpacked>();
AddStep<wgt::configuration::StepParse>(
AddStep<ci::filesystem::StepCreateIcons>();
AddStep<wgt::filesystem::StepCopyPreviewIcons>();
AddStep<wgt::security::StepCheckExtensionPrivileges>();
- AddStep<ci::security::StepUpdateSecurity>();
AddStep<wgt::pkgmgr::StepGenerateXml>();
AddStep<ci::pkgmgr::StepUpdateApplication>();
+ AddStep<ci::security::StepUpdateSecurity>();
AddStep<ci::pkgmgr::StepRunParserPlugin>(
ci::Plugin::ActionType::Upgrade);
AddStep<ci::filesystem::StepChangeOwnershipAndPermission>();
AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
- break;
- }
- case ci::RequestType::ManifestDirectInstall: {
+ }
+
+ void WgtInstaller::ManifestDirectInstallSteps() {
AddStep<ci::configuration::StepConfigure>(pkgmgr_);
AddStep<wgt::configuration::StepParse>(
wgt::configuration::StepParse::ConfigLocation::INSTALLED, true);
AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
AddStep<wgt::filesystem::StepWgtPatchIcons>();
AddStep<wgt::pkgmgr::StepGenerateXml>();
- AddStep<ci::security::StepRegisterSecurity>();
AddStep<ci::pkgmgr::StepRegisterApplication>();
+ AddStep<ci::security::StepRegisterSecurity>();
AddStep<ci::pkgmgr::StepRunParserPlugin>(ci::Plugin::ActionType::Install);
AddStep<ci::filesystem::StepCreatePerUserStorageDirectories>(
wgt::filesystem::WgtAdditionalSharedDirs);
AddStep<ci::filesystem::StepChangeOwnershipAndPermission>();
AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
- break;
- }
- case ci::RequestType::ManifestDirectUpdate: {
+ }
+
+ void WgtInstaller::ManifestDirectUpdateSteps() {
AddStep<ci::configuration::StepConfigure>(pkgmgr_);
AddStep<wgt::configuration::StepParse>(
wgt::configuration::StepParse::ConfigLocation::INSTALLED, true);
ci::configuration::StepParseManifest::StoreLocation::BACKUP);
AddStep<ci::pkgmgr::StepKillApps>();
AddStep<ci::filesystem::StepCopyTep>();
- AddStep<ci::security::StepUpdateSecurity>();
AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
AddStep<wgt::filesystem::StepWgtPatchIcons>();
AddStep<wgt::pkgmgr::StepGenerateXml>();
AddStep<ci::pkgmgr::StepUpdateApplication>();
+ AddStep<ci::security::StepUpdateSecurity>();
AddStep<ci::pkgmgr::StepRunParserPlugin>(
ci::Plugin::ActionType::Upgrade);
AddStep<ci::filesystem::StepChangeOwnershipAndPermission>();
AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
- break;
- }
- case ci::RequestType::ReadonlyUpdateInstall: {
+ }
+
+ void WgtInstaller::ReadonlyUpdateInstallSteps() {
AddStep<ci::configuration::StepConfigure>(pkgmgr_);
AddStep<ci::filesystem::StepUnzip>();
AddStep<wgt::configuration::StepParse>(
AddStep<ci::pkgmgr::StepRunParserPlugin>(ci::Plugin::ActionType::Upgrade);
AddStep<ci::filesystem::StepChangeOwnershipAndPermission>();
AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
- break;
- }
- case ci::RequestType::ReadonlyUpdateUninstall: {
+ }
+
+ void WgtInstaller::ReadonlyUpdateUninstallSteps() {
AddStep<ci::configuration::StepConfigure>(pkgmgr_);
AddStep<ci::pkgmgr::StepCheckRestriction>();
AddStep<ci::pkgmgr::StepCheckRemovable>();
AddStep<ci::security::StepUpdateSecurity>();
AddStep<ci::pkgmgr::StepRemoveManifest>();
AddStep<ci::pkgmgr::StepRunParserPlugin>(ci::Plugin::ActionType::Upgrade);
- break;
- }
- case ci::RequestType::ManifestPartialInstall: {
+ }
+
+ void WgtInstaller::ManifestPartialInstallSteps() {
AddStep<ci::configuration::StepConfigure>(pkgmgr_);
AddStep<wgt::configuration::StepParse>(
wgt::configuration::StepParse::ConfigLocation::INSTALLED, true);
AddStep<ci::configuration::StepParsePreload>();
+ AddStep<ci::security::StepCheckSignature>();
AddStep<ci::security::StepPrivilegeCompatibility>(
ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT);
AddStep<wgt::security::StepCheckWgtBackgroundCategory>();
AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
- AddStep<ci::security::StepRegisterSecurity>();
AddStep<ci::pkgmgr::StepRegisterApplication>();
+ AddStep<ci::security::StepRegisterSecurity>();
AddStep<ci::pkgmgr::StepRunParserPlugin>(ci::Plugin::ActionType::Install);
AddStep<ci::filesystem::StepCreatePerUserStorageDirectories>(
wgt::filesystem::WgtAdditionalSharedDirs);
AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
- break;
- }
- case ci::RequestType::ManifestPartialUpdate: {
+ }
+
+ void WgtInstaller::ManifestPartialUpdateSteps() {
AddStep<ci::configuration::StepConfigure>(pkgmgr_);
AddStep<wgt::configuration::StepParse>(
wgt::configuration::StepParse::ConfigLocation::INSTALLED, true);
AddStep<ci::configuration::StepParseManifest>(
ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
ci::configuration::StepParseManifest::StoreLocation::BACKUP);
+ AddStep<ci::security::StepCheckSignature>();
AddStep<ci::security::StepPrivilegeCompatibility>(
ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT);
AddStep<wgt::security::StepCheckWgtBackgroundCategory>();
- AddStep<ci::security::StepUpdateSecurity>();
+ AddStep<ci::pkgmgr::StepKillApps>();
AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
AddStep<ci::pkgmgr::StepUpdateApplication>();
+ AddStep<ci::security::StepUpdateSecurity>();
AddStep<ci::pkgmgr::StepRunParserPlugin>(
ci::Plugin::ActionType::Upgrade);
AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
- break;
- }
- case ci::RequestType::PartialUninstall: {
+ }
+
+ void WgtInstaller::ManifestPartialUninstallSteps() {
AddStep<ci::configuration::StepConfigure>(pkgmgr_);
AddStep<ci::pkgmgr::StepCheckRestriction>();
AddStep<ci::pkgmgr::StepCheckRemovable>();
AddStep<ci::pkgmgr::StepUnregisterApplication>();
AddStep<wgt::encryption::StepRemoveEncryptionData>();
AddStep<ci::security::StepRevokeSecurity>();
- break;
- }
- case ci::RequestType::Move: {
+ }
+
+ void WgtInstaller::MoveSteps() {
AddStep<ci::configuration::StepConfigure>(pkgmgr_);
AddStep<ci::configuration::StepParseManifest>(
ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
AddStep<ci::pkgmgr::StepKillApps>();
AddStep<ci::filesystem::StepMoveInstalledStorage>();
AddStep<ci::security::StepRegisterSecurity>();
- break;
- }
- case ci::RequestType::EnablePkg: {
+ }
+
+ void WgtInstaller::EnablePkgSteps() {
AddStep<ci::configuration::StepConfigure>(pkgmgr_);
AddStep<ci::configuration::StepParseManifest>(
ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
ci::pkgmgr::StepUpdatePkgDisableInfo::ActionType::Enable);
AddStep<ci::pkgmgr::StepRunParserPlugin>(
ci::Plugin::ActionType::Uninstall);
- break;
- }
- case ci::RequestType::DisablePkg: {
+ }
+
+ void WgtInstaller::DisablePkgSteps() {
AddStep<ci::configuration::StepConfigure>(pkgmgr_);
AddStep<ci::configuration::StepParseManifest>(
ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
ci::pkgmgr::StepUpdatePkgDisableInfo::ActionType::Disable);
AddStep<ci::pkgmgr::StepRunParserPlugin>(
ci::Plugin::ActionType::Uninstall);
- break;
- }
- default: {
+ }
+
+ void WgtInstaller::MigrateExtImgSteps() {
+ AddStep<ci::configuration::StepConfigure>(pkgmgr_);
+ AddStep<ci::security::StepMigrateLegacyExtImage>();
+ AddStep<ci::filesystem::StepChangeOwnershipAndPermission>();
+ }
+
+ void WgtInstaller::DefaultSteps() {
AddStep<ci::configuration::StepFail>();
- }
}
-}
} // namespace wgt