support installation of TPK as preload app. 13/59513/5
authorjongmyeongko <jongmyeong.ko@samsung.com>
Tue, 16 Feb 2016 07:10:01 +0000 (16:10 +0900)
committerjongmyeong ko <jongmyeong.ko@samsung.com>
Thu, 18 Feb 2016 03:56:18 +0000 (19:56 -0800)
Usage : (root-shell)#tpk-backend -i {path of tpk} --preload

Change-Id: Ibc548e7dd7511afad15fea43a84433a86052a254
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
src/common/step/step_configure.cc

index d606328..7d8dfd7 100644 (file)
@@ -32,7 +32,6 @@ Step::Status StepConfigure::process() {
   SetupRequestMode();
   SetupRequestType();
   SetupFileCreationMask();
-  SetupIsPreloadRequest();
 
   if (!SetupRootAppDirectory())
     return Status::CONFIG_ERROR;
@@ -139,14 +138,21 @@ Step::Status StepConfigure::process() {
 }
 
 Step::Status StepConfigure::precheck() {
+  SetupIsPreloadRequest();
+
   if (pkgmgr_->GetRequestType() != RequestType::ManifestDirectInstall &&
       pkgmgr_->GetRequestType() != RequestType::ManifestDirectUpdate) {
     if (getuid() == 0) {
-      LOG(ERROR) << "App-installer should not run with superuser!";
-      return Status::OPERATION_NOT_ALLOWED;
+      if (context_->is_preload_request.get()) {
+        LOG(INFO) << "Allowing installation from root user for "
+                     "preload request mode.";
+      } else {
+        LOG(ERROR) << "App-installer should not run with superuser!";
+        return Status::OPERATION_NOT_ALLOWED;
+      }
     }
   } else {
-    LOG(INFO) << "Allowing installation from root user for"
+    LOG(INFO) << "Allowing installation from root user for "
                  "manifest direct request mode.";
   }
   return Status::OK;