skip neos update confirmation if fully cached (#20779)
* skip neos update confirmation if fully cached * update bin Co-authored-by: Comma Device <device@comma.ai>albatross
parent
cacb799a82
commit
563cdd39c0
|
@ -331,7 +331,7 @@ Directory Structure
|
|||
.
|
||||
├── cereal # The messaging spec and libs used for all logs
|
||||
├── common # Library like functionality we've developed here
|
||||
├── installer/updater # Manages auto-updates of openpilot
|
||||
├── installer/updater # Manages auto-updates of NEOS
|
||||
├── opendbc # Files showing how to interpret data from cars
|
||||
├── panda # Code used to communicate on CAN
|
||||
├── phonelibs # Libraries used on NEOS devices
|
||||
|
|
Binary file not shown.
|
@ -250,7 +250,12 @@ struct Updater {
|
|||
b_y = 720;
|
||||
b_h = 220;
|
||||
|
||||
state = CONFIRMATION;
|
||||
if (download_stage(true)) {
|
||||
state = RUNNING;
|
||||
update_thread_handle = std::thread(&Updater::run_stages, this);
|
||||
} else {
|
||||
state = CONFIRMATION;
|
||||
}
|
||||
}
|
||||
|
||||
int download_file_xferinfo(curl_off_t dltotal, curl_off_t dlno,
|
||||
|
@ -351,11 +356,15 @@ struct Updater {
|
|||
state = RUNNING;
|
||||
}
|
||||
|
||||
std::string download(std::string url, std::string hash, std::string name) {
|
||||
std::string download(std::string url, std::string hash, std::string name, bool dry_run) {
|
||||
std::string out_fn = UPDATE_DIR "/" + util::base_name(url);
|
||||
|
||||
// start or resume downloading if hash doesn't match
|
||||
std::string fn_hash = sha256_file(out_fn);
|
||||
if (dry_run) {
|
||||
return (hash.compare(fn_hash) != 0) ? "" : out_fn;
|
||||
}
|
||||
|
||||
// start or resume downloading if hash doesn't match
|
||||
if (hash.compare(fn_hash) != 0) {
|
||||
set_progress("Downloading " + name + "...");
|
||||
bool r = download_file(url, out_fn);
|
||||
|
@ -377,14 +386,14 @@ struct Updater {
|
|||
return out_fn;
|
||||
}
|
||||
|
||||
bool download_stage() {
|
||||
bool download_stage(bool dry_run = false) {
|
||||
curl = curl_easy_init();
|
||||
assert(curl);
|
||||
|
||||
// ** quick checks before download **
|
||||
|
||||
if (!check_space()) {
|
||||
set_error("2GB of free space required to update");
|
||||
if (!dry_run) set_error("2GB of free space required to update");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -432,7 +441,7 @@ struct Updater {
|
|||
printf("existing recovery hash: %s\n", existing_recovery_hash.c_str());
|
||||
|
||||
if (existing_recovery_hash != recovery_hash) {
|
||||
recovery_fn = download(recovery_url, recovery_hash, "recovery");
|
||||
recovery_fn = download(recovery_url, recovery_hash, "recovery", dry_run);
|
||||
if (recovery_fn.empty()) {
|
||||
// error'd
|
||||
return false;
|
||||
|
@ -441,7 +450,7 @@ struct Updater {
|
|||
}
|
||||
|
||||
// ** handle ota download **
|
||||
ota_fn = download(ota_url, ota_hash, "update");
|
||||
ota_fn = download(ota_url, ota_hash, "update", dry_run);
|
||||
if (ota_fn.empty()) {
|
||||
//error'd
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue