diff --git a/services/updater_main.cpp b/services/updater_main.cpp index 4306cf08acad6508b2e8e475dca6784c94561398..1957081c14fcd24f2c10705063f40907c3aff96b 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 699df7ee794b417234a1b392cf3effdcabb0332d..abb9ff5b346dee69b759f8201d776022eb885f19 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);