Change initdb tool behavior 24/274524/2
authorJunghyun Yeon <jungh.yeon@samsung.com>
Mon, 2 May 2022 00:30:51 +0000 (09:30 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Mon, 2 May 2022 02:05:12 +0000 (11:05 +0900)
Initdb will be executed even one of installation has failed.

Change-Id: I9c2c78674c7fd89a7b6f7592e2f963fddc228331
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/pkg_initdb/init_pkg_db.cc

index a4d4d4e..cae8869 100644 (file)
@@ -95,41 +95,43 @@ bool InitPkgDB::LoadDirectory(const std::string& path,
     bool preload) {
   ManifestLoader manifest_loader(path);
   std::list<ManifestInfo> manifest_list = manifest_loader.LoadManifest();
+  bool result = true;
 
   for (auto &manifest_info : manifest_list) {
     std::cerr << "Manifest : " << std::get<0>(manifest_info) <<
         (option_checker_.IsPartialRW() ? " (rw-only)":" (all)") << std::endl;
     if (!RunBackend(std::get<1>(manifest_info),
                     std::get<2>(manifest_info), preload))
-      return false;
+      result = false;
   }
-  return true;
+  return result;
 }
 
 bool InitPkgDB::Run() {
   if (!HandleDatabase())
     return false;
 
+  bool result = true;
   if (option_checker_.IsGlobal()) {
     if (!option_checker_.IsRWOnly())
       if (!LoadDirectory(tzplatform_getenv(TZ_SYS_RO_PACKAGES), true))
-        return false;
+        result = false;
 
     if (option_checker_.IsROOnly())
-      return true;
+      return result;
 
     if (!LoadDirectory(tzplatform_getenv(TZ_SYS_RW_PACKAGES), false))
-      return false;
+      result = false;
   } else {
     // Specified user location
     tzplatform_set_user(option_checker_.GetUid());
     std::string user_dir(tzplatform_getenv(TZ_USER_PACKAGES));
     tzplatform_reset_user();
     if (!LoadDirectory(user_dir, false))
-      return false;
+      result = false;
   }
 
-  return true;
+  return result;
 }
 
 bool InitPkgDB::HandleDatabase() {