Implement StepRestoreWgtSymbolicLink
[platform/core/appfw/wgt-backend.git] / src / wgt / wgt_installer.cc
index ee1f9b3..9bbdd93 100755 (executable)
@@ -11,6 +11,7 @@
 #include <common/step/backup/step_backup_manifest.h>
 #include <common/step/backup/step_copy_backup.h>
 #include <common/step/configuration/step_block_cross_update.h>
+#include <common/step/configuration/step_check_install_location.h>
 #include <common/step/configuration/step_check_tizen_version.h>
 #include <common/step/configuration/step_configure.h>
 #include <common/step/configuration/step_fail.h>
@@ -34,6 +35,7 @@
 #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_globalapp_symlinks.h>
 #include <common/step/filesystem/step_recover_icons.h>
 #include <common/step/filesystem/step_recover_manifest.h>
 #include <common/step/filesystem/step_recover_external_storage.h>
@@ -47,6 +49,8 @@
 #include <common/step/filesystem/step_remove_tep.h>
 #include <common/step/filesystem/step_remove_zip_image.h>
 #include <common/step/filesystem/step_unzip.h>
+#include <common/step/filesystem/step_update_per_user_storage_directories.h>
+#include <common/step/filesystem/step_update_storage_directories.h>
 #include <common/step/filesystem/step_update_tep.h>
 #include <common/step/mount/step_mount_install.h>
 #include <common/step/mount/step_mount_recover.h>
 #include <common/step/recovery/step_open_recovery_file.h>
 #include <common/step/security/step_check_old_certificate.h>
 #include <common/step/security/step_check_signature.h>
+#include <common/step/security/step_privacy_privilege.h>
 #include <common/step/security/step_privilege_compatibility.h>
+#include <common/step/security/step_recover_privilege_compatibility.h>
 #include <common/step/security/step_recover_security.h>
+#include <common/step/security/step_recover_trust_anchor.h>
 #include <common/step/security/step_register_security.h>
 #include <common/step/security/step_revoke_security.h>
-#include <common/step/security/step_rollback_deinstallation_security.h>
 #include <common/step/security/step_rollback_installation_security.h>
 #include <common/step/security/step_update_security.h>
+#include <common/step/security/step_register_trust_anchor.h>
+#include <common/step/security/step_revoke_trust_anchor.h>
+#include <common/step/security/step_save_signature.h>
+#include <common/step/security/step_unregister_trust_anchor.h>
 
 #include <wgt_manifest_handlers/widget_config_parser.h>
 
@@ -88,6 +98,7 @@
 #include "wgt/step/encryption/step_remove_encryption_data.h"
 #include "wgt/step/filesystem/step_copy_preview_icons.h"
 #include "wgt/step/filesystem/step_create_symbolic_link.h"
+#include "wgt/step/filesystem/step_restore_wgt_symbolic_link.h"
 #include "wgt/step/filesystem/step_wgt_patch_icons.h"
 #include "wgt/step/filesystem/step_wgt_patch_storage_directories.h"
 #include "wgt/step/filesystem/step_wgt_prepare_package_directory.h"
@@ -200,11 +211,13 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::filesystem::StepUnzip>();
       AddStep<wgt::configuration::StepParse>(
         wgt::configuration::StepParse::ConfigLocation::PACKAGE, true);
+      AddStep<ci::configuration::StepCheckInstallLocation>();
       AddStep<ci::pkgmgr::StepCheckInstallable>();
       AddStep<ci::configuration::StepParsePreload>();
       AddStep<ci::pkgmgr::StepCheckRestriction>();
       AddStep<ci::configuration::StepCheckTizenVersion>();
       AddStep<ci::security::StepCheckSignature>();
+      AddStep<ci::security::StepSaveSignature>();
       AddStep<ci::security::StepPrivilegeCompatibility>(
           ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT);
       AddStep<wgt::security::StepCheckSettingsLevel>();
@@ -227,6 +240,10 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<wgt::security::StepCheckExtensionPrivileges>();
       AddStep<wgt::pkgmgr::StepGenerateXml>();
       AddStep<ci::pkgmgr::StepRegisterApplication>();
+      AddStep<ci::security::StepRegisterTrustAnchor>(
+          ci::security::StepRegisterTrustAnchor::RegisterType::INSTALL);
+      AddStep<ci::security::StepPrivacyPrivilege>(
+          ci::security::StepPrivacyPrivilege::ActionType::Install);
       AddStep<ci::security::StepRegisterSecurity>();
       AddStep<ci::pkgmgr::StepRunParserPlugin>(
           ci::Plugin::ActionType::Install);
@@ -241,9 +258,11 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::filesystem::StepUnzip>();
       AddStep<wgt::configuration::StepParse>(
           wgt::configuration::StepParse::ConfigLocation::PACKAGE, true);
+      AddStep<ci::configuration::StepCheckInstallLocation>();
       AddStep<ci::configuration::StepParsePreload>();
       AddStep<ci::configuration::StepCheckTizenVersion>();
       AddStep<ci::security::StepCheckSignature>();
+      AddStep<ci::security::StepSaveSignature>();
       AddStep<ci::security::StepPrivilegeCompatibility>(
           ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT);
       AddStep<wgt::security::StepCheckSettingsLevel>();
@@ -262,8 +281,10 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::backup::StepBackupIcons>();
       AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
       AddStep<ci::filesystem::StepAcquireExternalStorage>(true);
+      AddStep<ci::security::StepRevokeTrustAnchor>();
       AddStep<ci::backup::StepCopyBackup>();
       AddStep<ci::filesystem::StepUpdateTep>();
+      AddStep<ci::filesystem::StepUpdateStorageDirectories>();
       AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
       AddStep<wgt::filesystem::StepCreateSymbolicLink>();
       AddStep<wgt::filesystem::StepWgtPatchIcons>();
@@ -273,9 +294,14 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<wgt::security::StepCheckExtensionPrivileges>();
       AddStep<wgt::pkgmgr::StepGenerateXml>();
       AddStep<ci::pkgmgr::StepUpdateApplication>();
+      AddStep<ci::security::StepRegisterTrustAnchor>(
+          ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE);
+      AddStep<ci::security::StepPrivacyPrivilege>(
+          ci::security::StepPrivacyPrivilege::ActionType::Update);
       AddStep<ci::security::StepUpdateSecurity>();
       AddStep<ci::pkgmgr::StepRunParserPlugin>(
           ci::Plugin::ActionType::Upgrade);
+      AddStep<ci::filesystem::StepUpdatePerUserStorageDirectories>();
       AddStep<ci::filesystem::StepChangeOwnershipAndPermission>();
       AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
   }
@@ -288,19 +314,24 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::configuration::StepParseManifest>(
           ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
           ci::configuration::StepParseManifest::StoreLocation::NORMAL);
+      AddStep<ci::configuration::StepCheckInstallLocation>();
       AddStep<ci::pkgmgr::StepKillApps>();
       AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
       AddStep<ci::filesystem::StepOptionalAcquireExternalStorage>();
       AddStep<ci::pkgmgr::StepRunParserPlugin>(
           ci::Plugin::ActionType::Uninstall);
-      AddStep<ci::filesystem::StepRemovePerUserStorageDirectories>();
+      AddStep<ci::filesystem::StepRemovePerUserStorageDirectories>(
+          wgt::filesystem::WgtAdditionalSharedDirs);
+      AddStep<wgt::filesystem::StepRestoreWgtSymbolicLink>();
       AddStep<ci::pkgmgr::StepUnregisterApplication>();
-      AddStep<ci::security::StepRollbackDeinstallationSecurity>();
       AddStep<ci::filesystem::StepRemoveTep>();
       AddStep<ci::filesystem::StepRemoveFiles>();
       AddStep<ci::filesystem::StepRemoveZipImage>();
       AddStep<ci::filesystem::StepRemoveIcons>();
       AddStep<wgt::encryption::StepRemoveEncryptionData>();
+      AddStep<ci::security::StepUnregisterTrustAnchor>();
+      AddStep<ci::security::StepPrivacyPrivilege>(
+          ci::security::StepPrivacyPrivilege::ActionType::Uninstall);
       AddStep<ci::security::StepRevokeSecurity>();
       AddStep<ci::pkgmgr::StepRemoveManifest>();
       AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
@@ -311,6 +342,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<wgt::configuration::StepCheckRDSManifest>();
       AddStep<wgt::configuration::StepParse>(
           wgt::configuration::StepParse::ConfigLocation::RESOURCE_WGT, false);
+      AddStep<ci::configuration::StepCheckInstallLocation>();
       AddStep<ci::configuration::StepParsePreload>();
       AddStep<ci::pkgmgr::StepCheckRestriction>();
       AddStep<ci::configuration::StepCheckTizenVersion>();
@@ -320,10 +352,15 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
           ci::configuration::StepParseManifest::StoreLocation::BACKUP);
       AddStep<ci::configuration::StepBlockCrossUpdate>();
       AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
+      AddStep<ci::security::StepRevokeTrustAnchor>();
       AddStep<ci::rds::StepRDSParse>();
       AddStep<ci::filesystem::StepUpdateTep>();
       AddStep<ci::rds::StepRDSModify>();
       AddStep<wgt::security::StepCheckExtensionPrivileges>();
+      AddStep<ci::security::StepRegisterTrustAnchor>(
+          ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE);
+      AddStep<ci::security::StepPrivacyPrivilege>(
+          ci::security::StepPrivacyPrivilege::ActionType::Update);
       AddStep<ci::security::StepUpdateSecurity>();
       AddStep<ci::filesystem::StepChangeOwnershipAndPermission>();
       AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
@@ -334,6 +371,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::filesystem::StepUnzip>();
       AddStep<wgt::configuration::StepParse>(
             wgt::configuration::StepParse::ConfigLocation::PACKAGE, false);
+      AddStep<ci::configuration::StepCheckInstallLocation>();
       AddStep<ci::configuration::StepParseManifest>(
           ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
           ci::configuration::StepParseManifest::StoreLocation::BACKUP);
@@ -345,6 +383,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::filesystem::StepDisableExternalMount>();
       AddStep<wgt::configuration::StepCheckStartFiles>();
       AddStep<ci::security::StepCheckSignature>();
+      AddStep<ci::security::StepSaveSignature>();
       AddStep<ci::security::StepPrivilegeCompatibility>(
           ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT);
       AddStep<wgt::security::StepCheckSettingsLevel>();
@@ -360,8 +399,10 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::backup::StepBackupIcons>();
       AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
       AddStep<ci::filesystem::StepAcquireExternalStorage>(true);
+      AddStep<ci::security::StepRevokeTrustAnchor>();
       AddStep<ci::backup::StepCopyBackup>();
       AddStep<ci::filesystem::StepUpdateTep>();
+      AddStep<ci::filesystem::StepUpdateStorageDirectories>();
       AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
       AddStep<wgt::filesystem::StepCreateSymbolicLink>();
       AddStep<wgt::filesystem::StepWgtPatchIcons>();
@@ -371,9 +412,14 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<wgt::security::StepCheckExtensionPrivileges>();
       AddStep<wgt::pkgmgr::StepGenerateXml>();
       AddStep<ci::pkgmgr::StepUpdateApplication>();
+      AddStep<ci::security::StepRegisterTrustAnchor>(
+          ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE);
+      AddStep<ci::security::StepPrivacyPrivilege>(
+          ci::security::StepPrivacyPrivilege::ActionType::Update);
       AddStep<ci::security::StepUpdateSecurity>();
       AddStep<ci::pkgmgr::StepRunParserPlugin>(
           ci::Plugin::ActionType::Upgrade);
+      AddStep<ci::filesystem::StepUpdatePerUserStorageDirectories>();
       AddStep<ci::filesystem::StepChangeOwnershipAndPermission>();
       AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
   }
@@ -390,12 +436,16 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::filesystem::StepRecoverExternalStorage>();
       AddStep<ci::filesystem::StepRecoverStorageDirectories>();
       AddStep<ci::filesystem::StepRecoverPerUserStorageDirectories>();
+      AddStep<ci::filesystem::StepRecoverGlobalAppSymlinks>();
       AddStep<ci::filesystem::StepRecoverFiles>();
       AddStep<ci::mount::StepMountRecover>();
       AddStep<wgt::security::StepWgtRecoverSignature>();
+      AddStep<ci::security::StepRecoverPrivilegeCompatibility>(
+          ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT);
       AddStep<ci::filesystem::StepRecoverChangeOwner>();
       AddStep<ci::security::StepRecoverSecurity>();
       AddStep<ci::pkgmgr::StepRecoverApplication>();
+      AddStep<ci::security::StepRecoverTrustAnchor>();
   }
 
   void WgtInstaller::MountInstallSteps() {
@@ -403,11 +453,13 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::mount::StepMountUnpacked>();
       AddStep<wgt::configuration::StepParse>(
           wgt::configuration::StepParse::ConfigLocation::PACKAGE, true);
+      AddStep<ci::configuration::StepCheckInstallLocation>();
       AddStep<ci::pkgmgr::StepCheckInstallable>();
       AddStep<ci::configuration::StepParsePreload>();
       AddStep<ci::pkgmgr::StepCheckRestriction>();
       AddStep<ci::configuration::StepCheckTizenVersion>();
       AddStep<ci::security::StepCheckSignature>();
+      AddStep<ci::security::StepSaveSignature>();
       AddStep<ci::security::StepPrivilegeCompatibility>(
           ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT);
       AddStep<wgt::security::StepCheckSettingsLevel>();
@@ -429,12 +481,16 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<wgt::pkgmgr::StepGenerateXml>();
       AddStep<wgt::security::StepCheckExtensionPrivileges>();
       AddStep<ci::pkgmgr::StepRegisterApplication>();
+      AddStep<ci::security::StepRegisterTrustAnchor>(
+          ci::security::StepRegisterTrustAnchor::RegisterType::INSTALL);
+      AddStep<ci::security::StepPrivacyPrivilege>(
+          ci::security::StepPrivacyPrivilege::ActionType::Install);
       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::StepChangeOwnershipAndPermission>(true);
       AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
   }
 
@@ -443,9 +499,11 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::mount::StepMountUnpacked>();
       AddStep<wgt::configuration::StepParse>(
           wgt::configuration::StepParse::ConfigLocation::PACKAGE, true);
+      AddStep<ci::configuration::StepCheckInstallLocation>();
       AddStep<ci::configuration::StepParsePreload>();
       AddStep<ci::configuration::StepCheckTizenVersion>();
       AddStep<ci::security::StepCheckSignature>();
+      AddStep<ci::security::StepSaveSignature>();
       AddStep<ci::security::StepPrivilegeCompatibility>(
           ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT);
       AddStep<wgt::security::StepCheckSettingsLevel>();
@@ -457,6 +515,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
           ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
           ci::configuration::StepParseManifest::StoreLocation::BACKUP);
       AddStep<ci::configuration::StepBlockCrossUpdate>();
+      AddStep<ci::security::StepRevokeTrustAnchor>();
       AddStep<ci::pkgmgr::StepKillApps>();
       AddStep<ci::backup::StepBackupManifest>();
       AddStep<ci::backup::StepBackupIcons>();
@@ -464,6 +523,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::mount::StepMountUpdate>();
       AddStep<wgt::filesystem::StepWgtUpdatePackageDirectory>();
       AddStep<ci::filesystem::StepUpdateTep>();
+      AddStep<ci::filesystem::StepUpdateStorageDirectories>();
       AddStep<wgt::filesystem::StepWgtPatchStorageDirectories>();
       AddStep<wgt::filesystem::StepCreateSymbolicLink>();
       AddStep<wgt::filesystem::StepWgtPatchIcons>();
@@ -472,10 +532,15 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<wgt::security::StepCheckExtensionPrivileges>();
       AddStep<wgt::pkgmgr::StepGenerateXml>();
       AddStep<ci::pkgmgr::StepUpdateApplication>();
+      AddStep<ci::security::StepRegisterTrustAnchor>(
+          ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE);
+      AddStep<ci::security::StepPrivacyPrivilege>(
+          ci::security::StepPrivacyPrivilege::ActionType::Update);
       AddStep<ci::security::StepUpdateSecurity>();
       AddStep<ci::pkgmgr::StepRunParserPlugin>(
           ci::Plugin::ActionType::Upgrade);
-      AddStep<ci::filesystem::StepChangeOwnershipAndPermission>();
+      AddStep<ci::filesystem::StepUpdatePerUserStorageDirectories>();
+      AddStep<ci::filesystem::StepChangeOwnershipAndPermission>(true);
       AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
   }
 
@@ -487,6 +552,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::configuration::StepParsePreload>();
       AddStep<ci::configuration::StepCheckTizenVersion>();
       AddStep<wgt::security::StepDirectManifestCheckSignature>();
+      AddStep<ci::security::StepSaveSignature>();
       AddStep<ci::security::StepPrivilegeCompatibility>(
           ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT);
       AddStep<wgt::security::StepCheckWgtNotificationCategory>();
@@ -498,6 +564,10 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<wgt::filesystem::StepWgtPatchIcons>();
       AddStep<wgt::pkgmgr::StepGenerateXml>();
       AddStep<ci::pkgmgr::StepRegisterApplication>();
+      AddStep<ci::security::StepRegisterTrustAnchor>(
+          ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE);
+      AddStep<ci::security::StepPrivacyPrivilege>(
+          ci::security::StepPrivacyPrivilege::ActionType::Install);
       AddStep<ci::security::StepRegisterSecurity>();
       AddStep<ci::pkgmgr::StepRunParserPlugin>(ci::Plugin::ActionType::Install);
       AddStep<ci::filesystem::StepCreatePerUserStorageDirectories>(
@@ -513,6 +583,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::configuration::StepParsePreload>();
       AddStep<ci::configuration::StepCheckTizenVersion>();
       AddStep<wgt::security::StepDirectManifestCheckSignature>();
+      AddStep<ci::security::StepSaveSignature>();
       AddStep<ci::security::StepPrivilegeCompatibility>(
           ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT);
       AddStep<wgt::security::StepCheckWgtNotificationCategory>();
@@ -528,9 +599,14 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<wgt::filesystem::StepWgtPatchIcons>();
       AddStep<wgt::pkgmgr::StepGenerateXml>();
       AddStep<ci::pkgmgr::StepUpdateApplication>();
+      AddStep<ci::security::StepRegisterTrustAnchor>(
+          ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE);
+      AddStep<ci::security::StepPrivacyPrivilege>(
+          ci::security::StepPrivacyPrivilege::ActionType::Update);
       AddStep<ci::security::StepUpdateSecurity>();
       AddStep<ci::pkgmgr::StepRunParserPlugin>(
           ci::Plugin::ActionType::Upgrade);
+      AddStep<ci::filesystem::StepUpdatePerUserStorageDirectories>();
       AddStep<ci::filesystem::StepChangeOwnershipAndPermission>();
       AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
   }
@@ -570,6 +646,10 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<wgt::security::StepCheckExtensionPrivileges>();
       AddStep<wgt::pkgmgr::StepGenerateXml>();
       AddStep<ci::pkgmgr::StepUpdateApplication>();
+      AddStep<ci::security::StepRegisterTrustAnchor>(
+          ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE);
+      AddStep<ci::security::StepPrivacyPrivilege>(
+          ci::security::StepPrivacyPrivilege::ActionType::Update);
       AddStep<ci::security::StepUpdateSecurity>();
       AddStep<ci::pkgmgr::StepRunParserPlugin>(ci::Plugin::ActionType::Upgrade);
       AddStep<ci::filesystem::StepChangeOwnershipAndPermission>();
@@ -587,8 +667,12 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::configuration::StepParseManifest>(
           ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
           ci::configuration::StepParseManifest::StoreLocation::NORMAL);
+      AddStep<ci::configuration::StepParsePreload>();
       AddStep<wgt::configuration::StepSetOldSignatureFilesLocation>();
       AddStep<ci::security::StepCheckSignature>();
+      AddStep<ci::security::StepSaveSignature>();
+      AddStep<ci::security::StepPrivilegeCompatibility>(
+          ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT);
       AddStep<ci::configuration::StepSwitchReadonlyMode>();
       AddStep<ci::pkgmgr::StepKillApps>();
       AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
@@ -596,6 +680,12 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::filesystem::StepRemoveFiles>();
       AddStep<ci::filesystem::StepRemoveZipImage>();
       AddStep<ci::pkgmgr::StepUpdateApplication>();
+      AddStep<ci::configuration::StepSwitchReadonlyMode>();
+      AddStep<ci::security::StepRevokeTrustAnchor>();
+      AddStep<ci::security::StepRegisterTrustAnchor>(
+          ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE);
+      AddStep<ci::security::StepPrivacyPrivilege>(
+          ci::security::StepPrivacyPrivilege::ActionType::Update);
       AddStep<ci::security::StepUpdateSecurity>();
       AddStep<ci::pkgmgr::StepRemoveManifest>();
       AddStep<ci::pkgmgr::StepRunParserPlugin>(ci::Plugin::ActionType::Upgrade);
@@ -607,11 +697,16 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
           wgt::configuration::StepParse::ConfigLocation::INSTALLED, true);
       AddStep<ci::configuration::StepParsePreload>();
       AddStep<ci::security::StepCheckSignature>();
+      AddStep<ci::security::StepSaveSignature>();
       AddStep<ci::security::StepPrivilegeCompatibility>(
           ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT);
       AddStep<wgt::security::StepCheckWgtBackgroundCategory>();
       AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
       AddStep<ci::pkgmgr::StepRegisterApplication>();
+      AddStep<ci::security::StepRegisterTrustAnchor>(
+          ci::security::StepRegisterTrustAnchor::RegisterType::INSTALL);
+      AddStep<ci::security::StepPrivacyPrivilege>(
+          ci::security::StepPrivacyPrivilege::ActionType::Install);
       AddStep<ci::security::StepRegisterSecurity>();
       AddStep<ci::pkgmgr::StepRunParserPlugin>(ci::Plugin::ActionType::Install);
       AddStep<ci::filesystem::StepCreatePerUserStorageDirectories>(
@@ -628,15 +723,21 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
           ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
           ci::configuration::StepParseManifest::StoreLocation::BACKUP);
       AddStep<ci::security::StepCheckSignature>();
+      AddStep<ci::security::StepSaveSignature>();
       AddStep<ci::security::StepPrivilegeCompatibility>(
           ci::security::StepPrivilegeCompatibility::InternalPrivType::WGT);
       AddStep<wgt::security::StepCheckWgtBackgroundCategory>();
       AddStep<ci::pkgmgr::StepKillApps>();
       AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
       AddStep<ci::pkgmgr::StepUpdateApplication>();
+      AddStep<ci::security::StepRegisterTrustAnchor>(
+          ci::security::StepRegisterTrustAnchor::RegisterType::UPDATE);
+      AddStep<ci::security::StepPrivacyPrivilege>(
+          ci::security::StepPrivacyPrivilege::ActionType::Update);
       AddStep<ci::security::StepUpdateSecurity>();
       AddStep<ci::pkgmgr::StepRunParserPlugin>(
           ci::Plugin::ActionType::Upgrade);
+      AddStep<ci::filesystem::StepUpdatePerUserStorageDirectories>();
       AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
   }
 
@@ -652,9 +753,14 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::filesystem::StepOptionalAcquireExternalStorage>();
       AddStep<ci::pkgmgr::StepRunParserPlugin>(
           ci::Plugin::ActionType::Uninstall);
-      AddStep<ci::filesystem::StepRemovePerUserStorageDirectories>();
+      AddStep<ci::filesystem::StepRemovePerUserStorageDirectories>(
+          wgt::filesystem::WgtAdditionalSharedDirs);
+      AddStep<wgt::filesystem::StepRestoreWgtSymbolicLink>();
       AddStep<ci::pkgmgr::StepUnregisterApplication>();
       AddStep<wgt::encryption::StepRemoveEncryptionData>();
+      AddStep<ci::security::StepUnregisterTrustAnchor>();
+      AddStep<ci::security::StepPrivacyPrivilege>(
+          ci::security::StepPrivacyPrivilege::ActionType::Uninstall);
       AddStep<ci::security::StepRevokeSecurity>();
   }
 
@@ -663,6 +769,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::configuration::StepParseManifest>(
           ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
           ci::configuration::StepParseManifest::StoreLocation::NORMAL);
+      AddStep<ci::configuration::StepCheckInstallLocation>();
       AddStep<ci::pkgmgr::StepKillApps>();
       AddStep<ci::filesystem::StepMoveInstalledStorage>();
       AddStep<ci::security::StepRegisterSecurity>();