diff options
author | Yo Chiang <yochiang@google.com> | 2020-12-28 20:14:34 +0800 |
---|---|---|
committer | Yo Chiang <yochiang@google.com> | 2020-12-29 18:59:50 +0800 |
commit | f9f5dbb8970ca9d882b1279c71485c2dc76c56ec (patch) | |
tree | 6845b973204f4c0b13fabe464bb6338d445d0063 | |
parent | 5e16e7a07b143c75566e90926f16ca40296f0f15 (diff) | |
download | gsid-f9f5dbb8970ca9d882b1279c71485c2dc76c56ec.tar.gz |
gsi_tool: check closePartition() after installation
Call closePartition() to check error status after each partition
installation, so that we don't enable and reboot a DSU while the
installation fails.
Bug: 165471299
Test: gsi_tool install
Change-Id: Ie1e5a97ee486af17c0d435853257d17e436a4553
-rw-r--r-- | gsi_tool.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gsi_tool.cpp b/gsi_tool.cpp index 56d6de1..c6057a2 100644 --- a/gsi_tool.cpp +++ b/gsi_tool.cpp @@ -278,6 +278,12 @@ static int Install(sp<IGsiService> gsid, int argc, char** argv) { << "\n"; return EX_SOFTWARE; } + status = gsid->closePartition(&error); + if (!status.isOk() || error != IGsiService::INSTALL_OK) { + std::cerr << "Could not closePartition(userdata): " << ErrorMessage(status, error) + << std::endl; + return EX_SOFTWARE; + } } status = gsid->createPartition(partition, gsiSize, true, &error); @@ -295,6 +301,13 @@ static int Install(sp<IGsiService> gsid, int argc, char** argv) { return EX_SOFTWARE; } + status = gsid->closePartition(&error); + if (!status.isOk() || error != IGsiService::INSTALL_OK) { + std::cerr << "Could not closePartition(" << partition + << "): " << ErrorMessage(status, error) << std::endl; + return EX_SOFTWARE; + } + status = gsid->closeInstall(&error); if (!status.isOk() || error != IGsiService::INSTALL_OK) { std::cerr << "Could not close DSU installation: " << ErrorMessage(status, error) << "\n"; @@ -417,6 +430,12 @@ static int CreatePartition(sp<IGsiService> gsid, int argc, char** argv) { } } + status = gsid->closePartition(&error); + if (!status.isOk() || error != IGsiService::INSTALL_OK) { + std::cerr << "Could not close DSU partition:" << ErrorMessage(status, error) << std::endl; + return EX_SOFTWARE; + } + status = gsid->closeInstall(&error); if (!status.isOk() || error != IGsiService::INSTALL_OK) { std::cerr << "Could not close DSU installation: " << ErrorMessage(status, error) |