Cloning one onion to another
Our company is deploying a fleet of onions and would like to know if there is a way of cloning one onion to another in a straightforward manner, including the /root directory, installed packages, and other system configuration (such as /etc/rc.local and other system-wide scripts). We can often set up over 5-10 at a time.
Previously we have used raspberry pis and this was very straightforward as you could just use dd to copy one SD card to another. However with the onion it seems to be much more difficult.
What approach would be recommended?
@Joshua-O-Leary the typical approach to deploying multiple identical Omega devices is to create your own firmware image and simply deploy it to each device. Firmeware images can include scripts and other files, once you have it set up it's easy to manage.
@crispyoz I would like to make a firmware image with custom files added to it. Is there a step-by-step guide on how to do this anywhere? Last time I tried to do it it wasn't very straightforward
@Joshua-O-Leary , start off with creating a firmware image from source code that u can flash onto ur onion.
The instructions are on the source code repository:
Once you have this working, adding files is trivial.
Once you clone the git repository to your local system, your source will be in /home/<user>/source
If your setup is different then just transpose my assumption to your reality.
If you want to create a file for example /etc/myapp/mydatafile that will be included in each firmware build, you would create that file in /home/<user>/source/files/etc/myapp/mydatafile
Now when you run make on the firmware source the resultant firmware image will include this file as required in /etc/myapp/mydatafile
Once you have cloned the git repository take a look in <source>/files/etc/uci-defaults you will see a load of numbered script files, these get executed in numeric order when the firmware is deployed so take a look at each of them to see if they may overwrite anything you might be deploying.
Two final hints.
make sure you follow the source installation instructions @UFD pointed you to and follow them step by step. If you take short-cuts, they'll end up being very very very long-cuts. Especially ensure you run onion-minimal-build.sh, it will save you maybe hours in building your firmware.
My last hint (ducking due to controversy) if you can, don't use a docker image it might be easier to set up but it's a dog of a thing, so better just install in a nice ubuntu 18 system and use that.
This is pretty straightforward...
dd if=/dev/mtd3 of=/tmp/firmware.bin