symlink control for read-only files of global app. 03/81503/11 accepted/tizen/common/20160817.133226 accepted/tizen/common/20160818.144506 accepted/tizen/ivi/20160819.063348 accepted/tizen/mobile/20160819.063206 accepted/tizen/tv/20160819.063330 accepted/tizen/wearable/20160819.063313 submit/tizen/20160817.084623 submit/tizen/20160818.060816
authorjongmyeongko <jongmyeong.ko@samsung.com>
Tue, 26 Jul 2016 12:20:52 +0000 (21:20 +0900)
committerjongmyeongko <jongmyeong.ko@samsung.com>
Thu, 11 Aug 2016 11:56:15 +0000 (20:56 +0900)
this is for new concept to support legacy app_path
for backward compatibility.

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

Change-Id: Iaa67c73e07dc49351866efbf89da864d31586905
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/tpk/step/filesystem/step_tpk_prepare_package_directory.cc
src/tpk/tpk_installer.cc

index 735be97780b82bb5384456bdf7f6a2ea6b914cad..ba3eeac18b5835d854287de944c3de6fe58851e1 100644 (file)
@@ -41,7 +41,7 @@ ci::Step::Status StepTpkPreparePackageDirectory::PrepareLink(
   if (bf::exists(mount_point_entry)) {
     bf::path destination = context_->pkg_path.get() / entry;
     if (bf::exists(destination)) {
-      if (!bf::is_symlink(destination)) {
+      if (!bf::is_symlink(symlink_status(destination))) {
         LOG(ERROR) << "Cannot proceed. "
                    << "Location of link is used by another file";
         return Status::APP_DIR_ERROR;
index 230a0196fc5f506f2bf8e799fd3f51d9ac6aaa6d..d86a752f4b2d10d8ef3c6e5046a9b0fa3d3f235a 100644 (file)
@@ -18,8 +18,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>
@@ -31,9 +31,9 @@
 #include <common/step/filesystem/step_recover_external_storage.h>
 #include <common/step/filesystem/step_recover_storage_directories.h>
 #include <common/step/filesystem/step_remove_files.h>
+#include <common/step/filesystem/step_remove_globalapp_symlinks.h>
 #include <common/step/filesystem/step_remove_icons.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>
@@ -160,6 +160,7 @@ void TpkInstaller::InstallSteps() {
   AddStep<tpk::configuration::StepAdjustInstallLocation>();
   AddStep<ci::security::StepPrivilegeCompatibility>();
   AddStep<tpk::security::StepCheckTpkBackgroundCategory>();
+  AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
   AddStep<ci::filesystem::StepAcquireExternalStorage>(false);
   AddStep<ci::security::StepRollbackInstallationSecurity>();
   AddStep<ci::filesystem::StepCopy>();
@@ -177,8 +178,8 @@ void TpkInstaller::InstallSteps() {
   AddStep<ci::pkgmgr::StepRunParserPlugin>(
       ci::Plugin::ActionType::Install);
   AddStep<ci::filesystem::StepCreatePerUserStorageDirectories>();
-  AddStep<ci::filesystem::StepCreateLegacyDirectories>();
   AddStep<ci::filesystem::StepChangeOwner>();
+  AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
 }
 
 void TpkInstaller::UpdateSteps() {
@@ -201,6 +202,7 @@ void TpkInstaller::UpdateSteps() {
   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>();
@@ -216,6 +218,7 @@ void TpkInstaller::UpdateSteps() {
   AddStep<ci::pkgmgr::StepUpdateApplication>();
   AddStep<ci::pkgmgr::StepRunParserPlugin>(ci::Plugin::ActionType::Upgrade);
   AddStep<ci::filesystem::StepChangeOwner>();
+  AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
 }
 
 void TpkInstaller::UninstallSteps() {
@@ -228,6 +231,7 @@ void TpkInstaller::UninstallSteps() {
   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<tpk::filesystem::StepRemoveExternalStorageDirectories>();
@@ -235,11 +239,11 @@ void TpkInstaller::UninstallSteps() {
   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<ci::security::StepRevokeSecurity>();
   AddStep<ci::pkgmgr::StepRemoveManifest>();
+  AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
 }
 
 void TpkInstaller::ReinstallSteps() {
@@ -263,6 +267,7 @@ void TpkInstaller::ReinstallSteps() {
   AddStep<ci::pkgmgr::StepKillApps>();
   AddStep<ci::backup::StepBackupManifest>();
   AddStep<ci::backup::StepBackupIcons>();
+  AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
   AddStep<ci::rds::StepRDSParse>();
   AddStep<tpk::rds::StepTpkRDSModify>();
   AddStep<ci::filesystem::StepUpdateTep>();
@@ -277,6 +282,7 @@ void TpkInstaller::ReinstallSteps() {
   AddStep<ci::pkgmgr::StepUpdateApplication>();
   AddStep<ci::pkgmgr::StepRunParserPlugin>(ci::Plugin::ActionType::Upgrade);
   AddStep<ci::filesystem::StepChangeOwner>();
+  AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
 }
 
 void TpkInstaller::DeltaSteps() {
@@ -301,6 +307,7 @@ void TpkInstaller::DeltaSteps() {
   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>();
@@ -314,6 +321,7 @@ void TpkInstaller::DeltaSteps() {
   AddStep<ci::pkgmgr::StepUpdateApplication>();
   AddStep<ci::pkgmgr::StepRunParserPlugin>(ci::Plugin::ActionType::Upgrade);
   AddStep<ci::filesystem::StepChangeOwner>();
+  AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
 }
 
 void TpkInstaller::MoveSteps() {
@@ -357,6 +365,7 @@ void TpkInstaller::MountInstallSteps() {
   AddStep<ci::security::StepPrivilegeCompatibility>();
   AddStep<tpk::security::StepCheckTpkBackgroundCategory>();
   AddStep<ci::security::StepRollbackInstallationSecurity>();
+  AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
   AddStep<ci::mount::StepMountInstall>();
   AddStep<tpk::filesystem::StepTpkPreparePackageDirectory>();
   AddStep<ci::filesystem::StepCopyTep>();
@@ -373,8 +382,8 @@ void TpkInstaller::MountInstallSteps() {
   AddStep<ci::pkgmgr::StepRunParserPlugin>(
       ci::Plugin::ActionType::Install);
   AddStep<ci::filesystem::StepCreatePerUserStorageDirectories>();
-  AddStep<ci::filesystem::StepCreateLegacyDirectories>();
   AddStep<ci::filesystem::StepChangeOwner>();
+  AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
 }
 
 void TpkInstaller::MountUpdateSteps() {
@@ -397,6 +406,7 @@ void TpkInstaller::MountUpdateSteps() {
   AddStep<ci::pkgmgr::StepKillApps>();
   AddStep<ci::backup::StepBackupManifest>();
   AddStep<ci::backup::StepBackupIcons>();
+  AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
   AddStep<ci::mount::StepMountUpdate>();
   AddStep<tpk::filesystem::StepTpkPreparePackageDirectory>();
   AddStep<ci::filesystem::StepUpdateTep>();
@@ -411,6 +421,7 @@ void TpkInstaller::MountUpdateSteps() {
   AddStep<tpk::filesystem::StepTpkGrantPermission>();
   AddStep<ci::pkgmgr::StepRunParserPlugin>(ci::Plugin::ActionType::Upgrade);
   AddStep<ci::filesystem::StepChangeOwner>();
+  AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
 }
 
 void TpkInstaller::ManifestDirectInstallSteps() {
@@ -418,6 +429,7 @@ void TpkInstaller::ManifestDirectInstallSteps() {
   AddStep<ci::configuration::StepParseManifest>(
       ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
       ci::configuration::StepParseManifest::StoreLocation::NORMAL);
+  AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
   AddStep<tpk::filesystem::StepCheckPkgDirPath>();
   AddStep<ci::configuration::StepParsePreload>();
   AddStep<ci::configuration::StepCheckTizenVersion>();
@@ -434,8 +446,8 @@ void TpkInstaller::ManifestDirectInstallSteps() {
   AddStep<tpk::filesystem::StepTpkGrantPermission>();
   AddStep<ci::pkgmgr::StepRunParserPlugin>(ci::Plugin::ActionType::Install);
   AddStep<ci::filesystem::StepCreatePerUserStorageDirectories>();
-  AddStep<ci::filesystem::StepCreateLegacyDirectories>();
   AddStep<ci::filesystem::StepChangeOwner>();
+  AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
 }
 
 void TpkInstaller::ManifestDirectUpdateSteps() {
@@ -443,6 +455,7 @@ void TpkInstaller::ManifestDirectUpdateSteps() {
   AddStep<ci::configuration::StepParseManifest>(
       ci::configuration::StepParseManifest::ManifestLocation::INSTALLED,
       ci::configuration::StepParseManifest::StoreLocation::NORMAL);
+  AddStep<ci::filesystem::StepRemoveGlobalAppSymlinks>();
   AddStep<ci::configuration::StepParsePreload>();
   AddStep<ci::configuration::StepCheckTizenVersion>();
   AddStep<tpk::pkgmgr::StepManifestAdjustment>();
@@ -459,6 +472,7 @@ void TpkInstaller::ManifestDirectUpdateSteps() {
   AddStep<tpk::filesystem::StepTpkGrantPermission>();
   AddStep<ci::pkgmgr::StepRunParserPlugin>(ci::Plugin::ActionType::Upgrade);
   AddStep<ci::filesystem::StepChangeOwner>();
+  AddStep<ci::filesystem::StepCreateGlobalAppSymlinks>();
 }
 
 void TpkInstaller::ClearSteps() {