RobertCNelson / boot-scripts

Just a bunch of useful scripts placed under /opt/scripts/
125 stars 132 forks source link

Make SSH key regeneration optional? #81

Closed matthijskooijman closed 6 years ago

matthijskooijman commented 6 years ago

After writing the SD card contents to the internal flash using init-eMMC-flasher-v3.sh, I was surprised that the SSH host key had changes. Looking at the scripts, this seems intentional.

Thinking about it, it makes sense when you use a single SD card for multiple boards. However, in my setup, I usually only flash once from an SD card. I start with a clean install on SD, then tweak it until I am satisfied, and once I am, I flash it to the eMMC and clear the SD card.

For my usecase (which I suspect others will also share), it would be good if the SSH-key reset (and, as I learned later, the macine-id reset which piggy-backs on the SSH-key reset) would be optional. It should probably be enabled by default, but some way to disable it would be good (a commandline option seems sensible, except that no options are supported so far)?

RobertCNelson commented 6 years ago

@matthijskooijman we can throw another variable in SOC.sh which helps pass the board, partition layout, etc..

https://github.com/RobertCNelson/omap-image-builder/commit/9a4989f66861a7e61ecbf995c6ef686258252efc

Regards,

matthijskooijman commented 6 years ago

Hm, is this really a variable that belongs in SOC.sh? That looks like variables describing the board and hardware, while the SSH regeneration toggle really seems like a (non-persistent) property of the flashing process itself. Looks like I can work with it, though.

RobertCNelson commented 6 years ago

Yeah it's the best place, but SOC.sh get's source in all the flashing/etc scripts. ;)

matthijskooijman commented 6 years ago

I suspect you mean "not the best place"?

In any case, I have no better suggestions. I was thinking about a commandline option to the script, but forgot that it's called through init=, which I'm pretty sure doesn't support arguments. Creating a new script just to toggle this setting is also overkill, so I guess SOC.sh it is.

Thanks for the quick responses in any case :-D