cmprovision
cmprovision copied to clipboard
Fix and update firmware download
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.
Thanks for this!
For me there were two things I had to do to get your PR working:
- Delete file
/var/lib/cmprovision/storage/app/firmware/latest, as your code wants to read that as a directory - After fetching latest firmware from UI, I had to move
pieeprom-files from newly created/var/lib/cmprovision/storage/app/firmware/latestdirectory into it's child directoryvar/lib/cmprovision/storage/app/firmware/stable. After that the firmware was visible underEEPROM firmware update to apply.
My PR is now open for more than 2 years. I am glad that it was actualy usefull for someone. Thanks! 🙂