From 758be2c9f1b6aea73b72790d7da83ae8a63aa779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=82=AC?= Date: Thu, 19 Dec 2024 15:22:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E5=8C=BA=E6=8C=82=E8=BD=BD=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E5=A2=9E=E5=8A=A0=E9=87=8D=E8=AF=95=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/updater_main.cpp | 19 ++++++++++++++++--- services/updater_main.h | 2 ++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/services/updater_main.cpp b/services/updater_main.cpp index 4306cf08..1957081c 100644 --- a/services/updater_main.cpp +++ b/services/updater_main.cpp @@ -360,6 +360,21 @@ static UpdaterStatus CalcProgress(const UpdaterParams &upParams, return UPDATE_SUCCESS; } +int CheckMountData() +{ + int retryTime = 3; + for (int i = 0; i < retryTime; i++) { + if (SetupPartitions() == 0) { + return 0; + } + LOG(INFO) << "retry mount userdata number:" << i; + Utils::UsSleep(DISPLAY_TIME); + } + UPDATER_UI_INSTANCE.ShowUpdInfo(TR(UPD_SETPART_FAIL), true); + UPDATER_LAST_WORD(UPDATE_ERROR); + return UPDATE_ERROR; +} + static UpdaterStatus PreUpdatePackages(UpdaterParams &upParams) { UPDATER_INIT_RECORD; @@ -368,9 +383,7 @@ static UpdaterStatus PreUpdatePackages(UpdaterParams &upParams) UpdaterStatus status = UPDATE_UNKNOWN; upParams.installTime.resize(upParams.updatePackage.size(), std::chrono::duration(0)); - if (SetupPartitions() != 0) { - UPDATER_UI_INSTANCE.ShowUpdInfo(TR(UPD_SETPART_FAIL), true); - UPDATER_LAST_WORD(UPDATE_ERROR); + if (CheckMountData() != 0) { return UPDATE_ERROR; } const std::string resultPath = std::string(UPDATER_PATH) + "/" + std::string(UPDATER_RESULT_FILE); diff --git a/services/updater_main.h b/services/updater_main.h index 699df7ee..abb9ff5b 100644 --- a/services/updater_main.h +++ b/services/updater_main.h @@ -33,6 +33,8 @@ int UpdaterMain(int argc, char **argv); int FactoryReset(FactoryResetMode mode, const std::string &path); +int CheckMountData(); + void RebootAfterUpdateSuccess(const UpdaterParams &upParams); UpdaterStatus InstallUpdaterPackage(UpdaterParams &upParams, Hpackage::PkgManager::PkgManagerPtr manager); -- Gitee