only show updater UI if necessary (#21787)

* only show updater UI if necessary

* cleanup

Co-authored-by: Comma Device <device@comma.ai>
old-commit-hash: 060592e34a
commatwo_master
Adeeb Shihadeh 4 years ago committed by GitHub
parent e6db374ac0
commit a4cf1e33d8
  1. 6
      launch_chffrplus.sh
  2. 8
      selfdrive/hardware/tici/agnos.py

@ -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
}

@ -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)

Loading…
Cancel
Save