For a new project, I plan to release ready-to-use bootable SDcard image files for various Raspberry Pi models (2, 3, Zero, Zero-W). The actual OS will be PiCore, the RAM-only Linux variant based on Tiny Core.
The required customization steps will be
- installing packages
- changing configuration files
- some Unix shell commands (like changing file permissions)
- generating or modifying some files.
The required steps are basically clear, but I want to minimize the manual effort AND remove the risk of errors or omissions AND have a single, transparent place for keeping track of the respective knowledge.
I could simply write down the required steps, execute them per each release, and then create and compress an SDcard image from that.
However, inspired by Larry Hasting's argument of automating task in Python rather than collections of shell scripts, I want to write a Python script that does most of the work in order to automate the future release cycles.
It is clear that the exact steps will have to evolve with future releases of the OS, and that there must be automated testing, too.
What is the best way to achieve this? My naive approach would be:
- Write a simple shell script #1 for downloading and burning the latest version of the OS to an SD card.
- Write a Python script that will
- connect to the Raspberry via SSH
- either execute the necessary shell commands for installing packages etc. via SSH or copying another Python script to the RBPi and then running it therefrom.
- A third script that generates an SDcard image, does some post-processing (e.g. compression) etc.
Has anybody done this before? Are there readily available tools for automating this?
SD Card Copier
tool that does this stuff for you (no coding required). https://github.com/raspberrypi-ui/piclone – Dougie Dec 27 '19 at 23:11