symlink control for read-only files of global app. 02/81502/10
authorjongmyeongko <jongmyeong.ko@samsung.com>
Tue, 26 Jul 2016 12:51:59 +0000 (21:51 +0900)
committerjongmyeongko <jongmyeong.ko@samsung.com>
Thu, 11 Aug 2016 05:34:19 +0000 (14:34 +0900)
this is for new concept to support legacy app_path
for backward compatibility.

Requires:
https://review.tizen.org/gerrit/#/c/81493/

Change-Id: I1ca76edc6dfe1c11a15a06e13b29c631779bf34e
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
Signed-off-by: Semun Lee <sm79.lee@samsung.com>
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
src/hybrid/hybrid_installer.cc
src/wgt/step/encryption/step_encrypt_resources.cc
src/wgt/step/filesystem/step_wgt_prepare_package_directory.cc
src/wgt/wgt_installer.cc

index 4d0d4e2..8d3060f 100644 (file)
@@ -19,8 +19,8 @@
 #include <common/step/filesystem/step_copy_storage_directories.h>
 #include <common/step/filesystem/step_copy_tep.h>
 #include <common/step/filesystem/step_create_icons.h>
+#include <common/step/filesystem/step_create_globalapp_symlinks.h>
 #include <common/step/filesystem/step_create_per_user_storage_directories.h>
-#include <common/step/filesystem/step_create_legacy_directories.h>
 #include <common/step/filesystem/step_create_storage_directories.h>
 #include <common/step/filesystem/step_delta_patch.h>
 #include <common/step/filesystem/step_disable_external_mount.h>
@@ -32,8 +32,8 @@
 #include <common/step/filesystem/step_recover_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 <common/step/filesystem/step_remove_per_user_storage_directories.h>
-#include <common/step/filesystem/step_remove_legacy_directories.h>
 #include <common/step/filesystem/step_remove_temporary_directory.h>
 #include <common/step/filesystem/step_remove_zip_image.h>
 #include <common/step/filesystem/step_remove_tep.h>
@@ -113,6 +113,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr)
       AddStep<wgt::security::StepCheckWgtImePrivilege>();
       AddStep<hybrid::encryption::StepEncryptResources>();
       AddStep<ci::security::StepRollbackInstallationSecurity>();
+      AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
       AddStep<ci::filesystem::StepAcquireExternalStorage>(false);
       AddStep<ci::filesystem::StepCopy>();
       AddStep<ci::filesystem::StepCopyTep>();
@@ -130,7 +131,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr)
       AddStep<ci::pkgmgr::StepRegisterApplication>();
       AddStep<ci::security::StepRegisterSecurity>();
       AddStep<ci::filesystem::StepCreatePerUserStorageDirectories>();
-      AddStep<ci::filesystem::StepCreateLegacyDirectories>();
+      AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
       break;
     case ci::RequestType::Update:
       AddStep<ci::configuration::StepConfigure>(pkgmgr_);
@@ -159,6 +160,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr)
       AddStep<ci::pkgmgr::StepKillApps>();
       AddStep<ci::backup::StepBackupManifest>();
       AddStep<ci::backup::StepBackupIcons>();
+      AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
       AddStep<ci::filesystem::StepAcquireExternalStorage>(true);
       AddStep<ci::backup::StepCopyBackup>();
       AddStep<ci::filesystem::StepUpdateTep>();
@@ -175,6 +177,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr)
       AddStep<ci::pkgmgr::StepUpdateApplication>();
       AddStep<ci::pkgmgr::StepRunParserPlugin>(
           ci::Plugin::ActionType::Upgrade);
+      AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
       break;
     case ci::RequestType::Uninstall:
       AddStep<ci::configuration::StepConfigure>(pkgmgr_);
@@ -186,18 +189,19 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr)
       AddStep<ci::pkgmgr::StepRunParserPlugin>(
           ci::Plugin::ActionType::Uninstall);
       AddStep<ci::pkgmgr::StepKillApps>();
+      AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
       AddStep<ci::filesystem::StepAcquireExternalStorage>(true);
       AddStep<ci::filesystem::StepRemovePerUserStorageDirectories>();
       AddStep<ci::pkgmgr::StepUnregisterApplication>();
       AddStep<ci::security::StepRollbackDeinstallationSecurity>();
       AddStep<ci::filesystem::StepRemoveTep>();
       AddStep<ci::filesystem::StepRemoveFiles>();
-      AddStep<ci::filesystem::StepRemoveLegacyDirectories>();
       AddStep<ci::filesystem::StepRemoveZipImage>();
       AddStep<ci::filesystem::StepRemoveIcons>();
       AddStep<wgt::encryption::StepRemoveEncryptionData>();
       AddStep<ci::security::StepRevokeSecurity>();
       AddStep<ci::pkgmgr::StepRemoveManifest>();
+      AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
       break;
     case ci::RequestType::Reinstall:
       // RDS is not supported for hybrid apps
@@ -232,6 +236,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr)
       AddStep<ci::pkgmgr::StepKillApps>();
       AddStep<ci::backup::StepBackupManifest>();
       AddStep<ci::backup::StepBackupIcons>();
+      AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
       AddStep<ci::filesystem::StepAcquireExternalStorage>(true);
       AddStep<ci::backup::StepCopyBackup>();
       AddStep<ci::filesystem::StepUpdateTep>();
@@ -248,6 +253,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr)
       AddStep<ci::pkgmgr::StepUpdateApplication>();
       AddStep<ci::pkgmgr::StepRunParserPlugin>(
           ci::Plugin::ActionType::Upgrade);
+      AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
       break;
     case ci::RequestType::Recovery:
       AddStep<ci::configuration::StepConfigure>(pkgmgr_);
@@ -292,6 +298,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr)
       AddStep<wgt::security::StepCheckWgtImePrivilege>();
       AddStep<hybrid::encryption::StepEncryptResources>();
       AddStep<ci::security::StepRollbackInstallationSecurity>();
+      AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
       AddStep<ci::mount::StepMountInstall>();
       AddStep<tpk::filesystem::StepTpkPreparePackageDirectory>();
       AddStep<ci::filesystem::StepCopyTep>();
@@ -309,7 +316,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr)
       AddStep<ci::pkgmgr::StepRegisterApplication>();
       AddStep<ci::security::StepRegisterSecurity>();
       AddStep<ci::filesystem::StepCreatePerUserStorageDirectories>();
-      AddStep<ci::filesystem::StepCreateLegacyDirectories>();
+      AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
       break;
     case ci::RequestType::MountUpdate:
       AddStep<ci::configuration::StepConfigure>(pkgmgr_);
@@ -338,6 +345,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr)
       AddStep<ci::pkgmgr::StepKillApps>();
       AddStep<ci::backup::StepBackupManifest>();
       AddStep<ci::backup::StepBackupIcons>();
+      AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
       AddStep<ci::mount::StepMountUpdate>();
       AddStep<tpk::filesystem::StepTpkUpdatePackageDirectory>();
       AddStep<ci::filesystem::StepUpdateTep>();
@@ -353,6 +361,7 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr)
       AddStep<ci::pkgmgr::StepUpdateApplication>();
       AddStep<ci::pkgmgr::StepRunParserPlugin>(
           ci::Plugin::ActionType::Upgrade);
+      AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
       break;
     case ci::RequestType::ManifestDirectInstall:
       AddStep<ci::configuration::StepConfigure>(pkgmgr_);
@@ -370,13 +379,14 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr)
       AddStep<wgt::security::StepCheckSettingsLevel>();
       AddStep<wgt::security::StepCheckWgtBackgroundCategory>();
       AddStep<ci::security::StepRollbackInstallationSecurity>();
+      AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
       AddStep<wgt::pkgmgr::StepGenerateXml>();
       AddStep<ci::pkgmgr::StepRunParserPlugin>(
           ci::Plugin::ActionType::Install);
       AddStep<ci::pkgmgr::StepRegisterApplication>();
       AddStep<ci::security::StepRegisterSecurity>();
       AddStep<ci::filesystem::StepCreatePerUserStorageDirectories>();
-      AddStep<ci::filesystem::StepCreateLegacyDirectories>();
+      AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
       break;
     case ci::RequestType::ManifestDirectUpdate:
       AddStep<ci::configuration::StepConfigure>(pkgmgr_);
@@ -400,10 +410,12 @@ HybridInstaller::HybridInstaller(common_installer::PkgMgrPtr pkgmgr)
           ci::configuration::StepParseManifest::StoreLocation::BACKUP);
       AddStep<ci::pkgmgr::StepKillApps>();
       AddStep<ci::security::StepUpdateSecurity>();
+      AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
       AddStep<wgt::pkgmgr::StepGenerateXml>();
       AddStep<ci::pkgmgr::StepUpdateApplication>();
       AddStep<ci::pkgmgr::StepRunParserPlugin>(
           ci::Plugin::ActionType::Upgrade);
+      AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
       break;
     case ci::RequestType::EnablePkg:
       AddStep<ci::configuration::StepConfigure>(pkgmgr_);
index c5e8d7a..f8d5640 100644 (file)
@@ -88,7 +88,7 @@ bool StepEncryptResources::Encrypt(const bf::path &src) {
       continue;
     }
 
-    bool is_sym = bf::is_symlink(current, error_code);
+    bool is_sym = bf::is_symlink(symlink_status(current, error_code));
     if (error_code)
       return false;
     if (is_sym)
index a4e1d6a..f4a1e6d 100644 (file)
@@ -29,7 +29,7 @@ ci::Step::Status StepWgtPreparePackageDirectory::CreateSymlinkToMountPoint() {
   bf::path mount_point = ci::GetMountLocation(context_->pkg_path.get());
   bf::path res_wgt_link = context_->pkg_path.get() / kResWgtDirectory;
   if (bf::exists(res_wgt_link)) {
-    if (!bf::is_symlink(res_wgt_link)) {
+    if (!bf::is_symlink(symlink_status(res_wgt_link))) {
       LOG(ERROR) << res_wgt_link << " is not symlink. Cannot proceed";
       return Status::APP_DIR_ERROR;
     }
index 01f2440..276fb30 100755 (executable)
@@ -21,8 +21,8 @@
 #include <common/step/filesystem/step_copy_storage_directories.h>
 #include <common/step/filesystem/step_copy_tep.h>
 #include <common/step/filesystem/step_create_icons.h>
+#include <common/step/filesystem/step_create_globalapp_symlinks.h>
 #include <common/step/filesystem/step_create_per_user_storage_directories.h>
-#include <common/step/filesystem/step_create_legacy_directories.h>
 #include <common/step/filesystem/step_create_storage_directories.h>
 #include <common/step/filesystem/step_delta_patch.h>
 #include <common/step/filesystem/step_disable_external_mount.h>
@@ -35,8 +35,8 @@
 #include <common/step/filesystem/step_recover_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 <common/step/filesystem/step_remove_per_user_storage_directories.h>
-#include <common/step/filesystem/step_remove_legacy_directories.h>
 #include <common/step/filesystem/step_remove_temporary_directory.h>
 #include <common/step/filesystem/step_remove_tep.h>
 #include <common/step/filesystem/step_remove_zip_image.h>
@@ -117,6 +117,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<wgt::encryption::StepEncryptResources>();
       AddStep<wgt::filesystem::StepWgtResourceDirectory>();
       AddStep<ci::security::StepRollbackInstallationSecurity>();
+      AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
       AddStep<ci::filesystem::StepAcquireExternalStorage>(false);
       AddStep<ci::filesystem::StepCopy>();
       AddStep<ci::filesystem::StepCopyTep>();
@@ -133,7 +134,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
           ci::Plugin::ActionType::Install);
       AddStep<ci::security::StepRegisterSecurity>();
       AddStep<ci::filesystem::StepCreatePerUserStorageDirectories>();
-      AddStep<ci::filesystem::StepCreateLegacyDirectories>();
+      AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
       break;
     }
     case ci::RequestType::Update: {
@@ -159,6 +160,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::pkgmgr::StepKillApps>();
       AddStep<ci::backup::StepBackupManifest>();
       AddStep<ci::backup::StepBackupIcons>();
+      AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
       AddStep<ci::filesystem::StepAcquireExternalStorage>(true);
       AddStep<ci::backup::StepCopyBackup>();
       AddStep<ci::filesystem::StepUpdateTep>();
@@ -174,6 +176,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::pkgmgr::StepRunParserPlugin>(
           ci::Plugin::ActionType::Upgrade);
       AddStep<ci::pkgmgr::StepUpdateApplication>();
+      AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
       break;
     }
     case ci::RequestType::Uninstall: {
@@ -184,6 +187,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
           ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
           ci::configuration::StepParseManifest::StoreLocation::NORMAL);
       AddStep<ci::pkgmgr::StepKillApps>();
+      AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
       AddStep<ci::filesystem::StepAcquireExternalStorage>(true);
       AddStep<ci::pkgmgr::StepRunParserPlugin>(
           ci::Plugin::ActionType::Uninstall);
@@ -192,12 +196,12 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::security::StepRollbackDeinstallationSecurity>();
       AddStep<ci::filesystem::StepRemoveTep>();
       AddStep<ci::filesystem::StepRemoveFiles>();
-      AddStep<ci::filesystem::StepRemoveLegacyDirectories>();
       AddStep<ci::filesystem::StepRemoveZipImage>();
       AddStep<ci::filesystem::StepRemoveIcons>();
       AddStep<wgt::encryption::StepRemoveEncryptionData>();
       AddStep<ci::security::StepRevokeSecurity>();
       AddStep<ci::pkgmgr::StepRemoveManifest>();
+      AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
       break;
     }
     case ci::RequestType::Reinstall: {
@@ -211,11 +215,13 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
           ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
           ci::configuration::StepParseManifest::StoreLocation::BACKUP);
       AddStep<ci::configuration::StepBlockCrossUpdate>();
+      AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
       AddStep<ci::rds::StepRDSParse>();
       AddStep<ci::filesystem::StepUpdateTep>();
       AddStep<wgt::rds::StepWgtRDSModify>();
       AddStep<wgt::security::StepCheckExtensionPrivileges>();
       AddStep<ci::security::StepUpdateSecurity>();
+      AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
       break;
     }
     case ci::RequestType::Delta: {
@@ -247,6 +253,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::pkgmgr::StepKillApps>();
       AddStep<ci::backup::StepBackupManifest>();
       AddStep<ci::backup::StepBackupIcons>();
+      AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
       AddStep<ci::filesystem::StepAcquireExternalStorage>(true);
       AddStep<ci::backup::StepCopyBackup>();
       AddStep<ci::filesystem::StepUpdateTep>();
@@ -262,6 +269,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::pkgmgr::StepRunParserPlugin>(
           ci::Plugin::ActionType::Upgrade);
       AddStep<ci::pkgmgr::StepUpdateApplication>();
+      AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
       break;
     }
     case ci::RequestType::Recovery: {
@@ -304,6 +312,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<wgt::security::StepCheckWgtImePrivilege>();
       AddStep<wgt::encryption::StepEncryptResources>();
       AddStep<ci::security::StepRollbackInstallationSecurity>();
+      AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
       AddStep<ci::mount::StepMountInstall>();
       AddStep<wgt::filesystem::StepWgtPreparePackageDirectory>();
       AddStep<ci::filesystem::StepCopyTep>();
@@ -320,7 +329,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::filesystem::StepCreatePerUserStorageDirectories>();
       AddStep<wgt::security::StepCheckExtensionPrivileges>();
       AddStep<ci::security::StepRegisterSecurity>();
-      AddStep<ci::filesystem::StepCreateLegacyDirectories>();
+      AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
       break;
     }
     case ci::RequestType::MountUpdate: {
@@ -344,6 +353,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::pkgmgr::StepKillApps>();
       AddStep<ci::backup::StepBackupManifest>();
       AddStep<ci::backup::StepBackupIcons>();
+      AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
       AddStep<ci::mount::StepMountUpdate>();
       AddStep<wgt::filesystem::StepWgtUpdatePackageDirectory>();
       AddStep<ci::filesystem::StepUpdateTep>();
@@ -358,6 +368,7 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::pkgmgr::StepRunParserPlugin>(
           ci::Plugin::ActionType::Upgrade);
       AddStep<ci::pkgmgr::StepUpdateApplication>();
+      AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
       break;
     }
     case ci::RequestType::ManifestDirectInstall: {
@@ -373,10 +384,12 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<wgt::security::StepCheckSettingsLevel>();
       AddStep<wgt::security::StepCheckWgtBackgroundCategory>();
       AddStep<ci::security::StepRollbackInstallationSecurity>();
+      AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
       AddStep<wgt::pkgmgr::StepGenerateXml>();
       AddStep<ci::pkgmgr::StepRegisterApplication>();
       AddStep<ci::pkgmgr::StepRunParserPlugin>(ci::Plugin::ActionType::Install);
       AddStep<ci::security::StepRegisterSecurity>();
+      AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
       break;
     }
     case ci::RequestType::ManifestDirectUpdate: {
@@ -397,10 +410,12 @@ WgtInstaller::WgtInstaller(ci::PkgMgrPtr pkgrmgr)
       AddStep<ci::pkgmgr::StepKillApps>();
       AddStep<ci::filesystem::StepCopyTep>();
       AddStep<ci::security::StepUpdateSecurity>();
+      AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
       AddStep<wgt::pkgmgr::StepGenerateXml>();
       AddStep<ci::pkgmgr::StepRunParserPlugin>(
           ci::Plugin::ActionType::Upgrade);
       AddStep<ci::pkgmgr::StepUpdateApplication>();
+      AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
       break;
     }
     case ci::RequestType::Move: {