cmprovision icon indicating copy to clipboard operation
cmprovision copied to clipboard

Fix and update firmware download

Open cl445 opened this issue 1 year ago • 2 comments

Fix and update firmware download process with error handling, logging, and file validation

Details:

  • Download firmware from master branch: Retrieve firmware files directly from the master branch on GitHub for consistency and updates.
  • Implement robust error handling: Catch potential exceptions during download, extraction, and file operations to prevent unexpected failures and provide informative error messages.
  • Integrate logging: Use the Log facade to track progress, status, and potential errors for easier debugging and monitoring.
  • Add file validation: Verify the downloaded file size and content to ensure integrity and prevent issues with empty or invalid files.
  • Extract specific subfolders: Extract only firmware files within latest and feature-specific subfolders for targeted updates.
  • Improve code readability: Enhance code clarity with better variable naming, comments, and formatting for easier maintenance.

cl445 avatar Feb 02 '24 08:02 cl445

Thanks for this!

For me there were two things I had to do to get your PR working:

  1. Delete file /var/lib/cmprovision/storage/app/firmware/latest, as your code wants to read that as a directory
  2. After fetching latest firmware from UI, I had to move pieeprom- files from newly created /var/lib/cmprovision/storage/app/firmware/latest directory into it's child directory var/lib/cmprovision/storage/app/firmware/stable. After that the firmware was visible under EEPROM firmware update to apply.

jacobsvante avatar Sep 23 '25 14:09 jacobsvante

My PR is now open for more than 2 years. I am glad that it was actualy usefull for someone. Thanks! 🙂

cl445 avatar Sep 23 '25 18:09 cl445