From a4cf1e33d8e0c7402f53c3c1b9d6ff73bfb616b0 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Thu, 29 Jul 2021 18:12:37 -0700 Subject: [PATCH] only show updater UI if necessary (#21787) * only show updater UI if necessary * cleanup Co-authored-by: Comma Device old-commit-hash: 060592e34ae4d1e53617909840a386d17c3226f0 --- launch_chffrplus.sh | 6 +++++- selfdrive/hardware/tici/agnos.py | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/launch_chffrplus.sh b/launch_chffrplus.sh index 8e270276fc..d8bf6da5cf 100755 --- a/launch_chffrplus.sh +++ b/launch_chffrplus.sh @@ -108,8 +108,12 @@ function tici_init { # Check if AGNOS update is required if [ $(< /VERSION) != "$AGNOS_VERSION" ]; then + AGNOS_PY="$DIR/selfdrive/hardware/tici/agnos.py" MANIFEST="$DIR/selfdrive/hardware/tici/agnos.json" - $DIR/selfdrive/hardware/tici/updater $DIR/selfdrive/hardware/tici/agnos.py $MANIFEST + if $AGNOS_PY --verify $MANIFEST; then + sudo reboot + fi + $DIR/selfdrive/hardware/tici/updater $AGNOS_PY $MANIFEST fi } diff --git a/selfdrive/hardware/tici/agnos.py b/selfdrive/hardware/tici/agnos.py index 64c3b48b30..d3b2ca96ec 100755 --- a/selfdrive/hardware/tici/agnos.py +++ b/selfdrive/hardware/tici/agnos.py @@ -227,6 +227,7 @@ if __name__ == "__main__": parser = argparse.ArgumentParser(description="Flash and verify AGNOS update", formatter_class=argparse.ArgumentDefaultsHelpFormatter) + parser.add_argument("--verify", action="store_true", help="Verify and perform swap if update ready") parser.add_argument("--swap", action="store_true", help="Verify and perform swap, downloads if necessary") parser.add_argument("manifest", help="Manifest json") args = parser.parse_args() @@ -234,7 +235,12 @@ if __name__ == "__main__": logging.basicConfig(level=logging.INFO) target_slot_number = get_target_slot_number() - if args.swap: + if args.verify: + if verify_agnos_update(args.manifest, target_slot_number): + swap(args.manifest, target_slot_number, logging) + exit(0) + exit(1) + elif args.swap: while not verify_agnos_update(args.manifest, target_slot_number): logging.error("Verification failed. Flashing AGNOS") flash_agnos_update(args.manifest, target_slot_number, logging)